MIME Types (original) (raw)

8.15

top contents ← prev up next →

Bogdan Popa <bogdan@defn.io>

(require net/mime-type) package: mime-type-lib

This module provides utilities for working with MIME types. Its MIME type table is based on the table that the Nginx web server uses by default.

procedure(path-mime-type p) → (or/c #f bytes?)
p : path?

Given a path p, this function looks up the MIME type for that path (based on its extension) and returns it.

procedure(register-mime-type! ext mime) → void?
ext : symbol?
mime : (or/c string? bytes?)

Adds mime as the mime type for ext in the global MIME type table. Replaces any existing entries for ext.

procedure(mime-type-ext mime) → (or/c #f symbol?)
mime : (or/c string? bytes?)

Returns the extension symbol for the given mime, if known.

Added in version 1.1 of package mime-type-lib.

top contents ← prev up next →