List of ALL MimeTypes on the Planet, mapped to File Extensions?

Viewed 57534

Is there a resource that lists ALL the mimeTypes in existence?

I have found a few places with under 1000 mimeTypes, but then they still don't include common ones like .rar, .fla, .rb, .docx!

Does anyone have a COMPLETE list of mimetypes? Not down to the most obsure "company-only" ones, but at least all of the ones we might use.

Also, I'm looking for a list that maps file extensions to mimeTypes.

11 Answers

I took the list from Apache mime.types as of Fri Sep 29 15:10:29 2017 UTC and wrote a script to convert it to a json mapping. The json is too big for stackoverflow answer. You can find it here mimes.json.

script to generate the mapping:

# mime_to_json.py
# get the mime.types from
# http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

import sys
import re
import json

mapping = {}
with open(sys.argv[1], "r") as handle:
    for line in handle:
        line = line.strip()
        if line[0] == "#":
            continue
        parts = re.split("\s+", line)
        mime = parts[0]
        del parts[0]
        for ext in parts:
            mapping[ext] = mime

print(json.dumps(mapping, indent=4, sort_keys=True))
Related