Skip to content

MIME-Types

A MIME media type are a specification of a content type on a network. Each MIME type is assigned by IANA and consists of two parts: the type and sub-type. Common examples are: text/plain, application/json and application/pdf.

Attribute Value Detail
name mimetype Used in schema definitions
label MIME-Type plural: MIME-Types
group mimetypes Used in search indexing to query all properties of a given type
matchable Suitable for use in entity matching
pivot Suitable for use as a pivot point for connecting to other entities

Well-known MIME types

Code Label
application/octet-stream Unknown file type
inode/directory Directory
inode/x-empty Empty file
text/plain Plain text
application/pdf Portable Document Format
application/vnd.ms-excel Microsoft Excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Microsoft Excel 2002+
application/vnd.ms-word Microsoft Word
application/vnd.openxmlformats-officedocument.wordprocessing Microsoft Word 2002+
text/csv Comma-separated table
text/rtf Rich text
image/vnd.adobe.photoshop Adobe Photoshop
application/rar WinRAR archive
application/zip Zip archive
application/gzip GZip archive
message/rfc822 Plain E-Mail
text/html HTML Web Page
image/jpeg JPEG Image
image/tiff Tagged Image File Format
image/x.djvu DejaVu E-Book
image/png Portable Network Graphics
image/gif Graphics Interchange Format
application/xml+opfmessage Microsoft Outlook for Mac E-Mail
application/vnd.ms-outlook Microsoft Outlook E-Mail
application/json JavaScript Object Notation
application/xml eXtensible Markup Language
application/json+ftm FollowTheMoney Entities
application/json+ftm-rslv FollowTheMoney Integrated
application/json+ftm-statements FollowTheMoney Statements

followthemoney.types.MimeType

Bases: PropertyType

A MIME media type are a specification of a content type on a network. Each MIME type is assigned by IANA and consists of two parts: the type and sub-type. Common examples are: text/plain, application/json and application/pdf.

MIME type properties do not contain parameters as used in HTTP headers, like charset=UTF-8.

Source code in followthemoney/types/mimetype.py
class MimeType(PropertyType):
    """A MIME media type are a specification of a content type on a network.
    Each MIME type is assigned by IANA and consists of two parts: the type
    and sub-type. Common examples are: `text/plain`, `application/json` and
    `application/pdf`.

    MIME type properties do not contain parameters as used in HTTP headers,
    like `charset=UTF-8`."""

    name = "mimetype"
    group = "mimetypes"
    label = _("MIME-Type")
    plural = _("MIME-Types")
    matchable = False

    def clean_text(
        self,
        text: str,
        fuzzy: bool = False,
        format: Optional[str] = None,
        proxy: Optional["EntityProxy"] = None,
    ) -> Optional[str]:
        text = normalize_mimetype(text)
        if text != DEFAULT:
            return text
        return None

    def caption(self, value: str, format: Optional[str] = None) -> str:
        return parse_mimetype(value).label or value