Files
2026-07-29 13:24:36 +02:00

522 B

racket-mimetypes

Returns the MIME type for a file extension, file name, or path.

The package uses a bundled fallback table and silently checks Apache's mime.types in a background thread. A successful update is checked again after seven days. A failed update is retried after one day. The validated table is cached below Racket's user cache directory.

(require racket-mimetypes)

(mimetype-for-ext "music.opus")
(mimetype-for-ext 'png)
(mimetype-for-ext "unknown" #:default "application/octet-stream")