Skip to content

mime ​

Returns the MIME type for a file based on its extension. Returns no value if the extension is unknown or the path has no extension. Unlike operations that return Result, mime has no recoverable failure case.

Signaturemime(path: string): string?

Example ​

tyrus
import { mime } from "tyrus:fs";

print(mime("file.txt")); // "text/plain"
print(mime("image.png")); // "image/png"
print(mime("file.xyz")); // null