What is the fastest way to tell whether a web resource is a text file?

Some Chrome URLs are just text files that are rendered as monospaced text files.
As an example, this is the Public Suffix List (https://publicsuffix.org/list/public_suffix_list.dat), and looks like this:

Public Suffix List

You can also get to this type of page by going to any raw GitHub user content, like https://raw.githubusercontent.com/github/docs/main/README.md.

I am building a Chrome extension and want to check what type of document the page has in the content script. My current code is this, and describes the HTML wrapper that I see around text:

const documentIsText = document.head.innerHTML.length === 0
        && document.body.children.length === 1
        && document.body.children[0].nodeName.toLowerCase() === 'pre'

This is the HTML wrapper I see:

<html data-lt-installed="true">
  <head></head>
  <body>
    <pre style="word-wrap: break-word; white-space: pre-wrap;">
    "Lots of text!"
    </pre>
  </body>
</html>

It seems like there should be some property of document that should answer this question.

It’s possible to check the document’s response header for content-type: text/plain with a background script, but I want to check for this information in a content script.

Question

What is the fastest way to definitively check that the page you are looking at is just text with client-side JavaScript after page load?