Web & Protocols · zero-dependency · MIT

larzmime

Look up a MIME type from a filename, no guessing.

A curated common subset (~50 types) covering the file types a real web app actually serves - not the full IANA registry, which is thousands of obscure entries most servers never need. is_text() answers the practical follow-up question: should this be served/edited as text.

larzscript pkg install mime
View on GitHub →Learn the stack

What you get

Try it

import "mime" as mime
print(mime.type_of("photo.jpg"))
print(mime.type_of("data.json"))
print(mime.type_of("weird.xyz"))
print(mime.is_text("style.css"))
Output
image/jpeg
application/json
application/octet-stream
true

Why it's in the Larz Stack

larzmime is a real Larzscript package (larzscript pkg install mime) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.