CHA-MIME.TYPES(5)

πŸ“¦
version 0.5.0 Β· 3 versions
, in alpine 3.24, arch rolling, nixpkgs unstable

πŸŽ€ mime.types πŸŽ€

ok so bestie, this is the mime.types page from the File Formats Manual β€” aka CHA-MIME.TYPES(5) if you're being formal about it πŸ’…. Sit down, grab a boba, we're mapping file extensions to MIME types and it's gonna be iconic.


✨ NAME ✨

mime.types β€” Chawan uses the mime.types file to map file extensions to MIME types (also known as Content-Type). periodt πŸ’–

MIME types in turn are used by mailcap to decide how to present a certain file to you: display it as text, use an external viewer, save it, etc. β€” the whole vibe check of "what do I even do with this file". See cha-mailcap(5) for the deets on how that works, iykyk 🫢


πŸ” Search path πŸ”

Chawan parses all mime.types files defined in external.mime-types. And when no mime.types file is found? No stress β€” the built-in MIME type associations get used instead πŸ’«

The default search path for mime.types files is literally:

$HOME/.mime.types:/etc/mime.types:/usr/etc/mime.types:/usr/local/etc/mime.types

no cap, that's the whole path, all four of them, separated by colons 🌈


πŸ“ Format πŸ“

So the mime.types file is just a list of whitespace-separated columns, bestie. Column one = the mime type. Every column after that? File extensions. Slay πŸ¦‹

Lines starting with a hash character (#) are recognized as comments and get ignored β€” they're giving background character energy, nobody looks at them πŸ’€

Example time:

# comment
application/x-example    exmpl     ex

So this mime.types file would register the file extensions exmpl and ex to be recognized as the mime type application/x-example. Obsessed, honestly πŸ‘‘


πŸ™ˆ Note πŸ™ˆ

ok important, don't skip this part:

Chawan only uses mime.types files for finding mailcap entries β€” buffers use an internal mime.types file for content type detection instead. Two different things, bestie, don't mix them up 😭

The default mime.types file only includes file formats that buffers can handle, which is... rather limited, ngl (at the time of writing, 7 file formats). Seven. SEVEN. So it is highly recommended to configure at least one external mime.types file if you use mailcap. This is your sign, go do it πŸ’œ


πŸ’– See also πŸ’–


fr fr go set up an external mime.types file. your mailcap game will thank you πŸ“

ok bye bestie, that was the whole page β€” made with love from the File Formats Manual, filed under CHA-MIME.TYPES(5) πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from