Media type (MIME type)

The standard label for a file's format, like application/pdf or image/png, trustworthy only when derived from the file's bytes, not its extension or a header.

definition

A media type (formerly MIME type) is a standardized two-part label: a type and a subtype, like application/pdf or image/png. It identifies the format of a piece of data.

Also called: MIME type, content type

in-plain-terms

An HTTP Content-Type header, an email attachment, or an extraction API's response all use a media type to say what kind of file it is. The label itself is just a string agreed on by a registry. Nothing enforces that a file's extension, its claimed Content-Type, or even a byte sequence someone renamed actually matches its label.

The trustworthy version of a media type is one derived from the file's own bytes: its magic-bytes signature and, beyond that, deeper container inspection. This is more reliable than one taken on faith from a filename or a header a client happened to send.

why-it-matters

  • A file renamed with the wrong extension, or served with an incorrect Content-Type header, will silently misroute in a pipeline that trusts the label. That's why a pipeline should check the bytes instead.
  • txtfetch reports metadata.content_type in every extraction response, derived from its own byte-level detection, so a caller can confirm what was actually processed.

how-to-check

  • Drop a file into the file type inspector. It fingerprints the file from its bytes rather than trusting its extension or claimed type. Fingerprint a file's real type

related-terms

faq

Is a file's media type the same as its extension?
Not reliably. An extension is just a filename convention with nothing enforcing that it matches the file's actual content. A trustworthy media type comes from inspecting the file's bytes, not reading its name.
Where does txtfetch report a file's media type?
In metadata.content_type on every extraction response, derived from its own byte-level detection rather than the filename or a client-supplied header.

related-reading

See the term in real output.

Drop a file into the free reader and watch it happen.

Open the file reader →

Get an API key →