MIME Types
path-mime-type
register-mime-type!
mime-type-ext
8.16.0.4

MIME Types🔗ℹ

Bogdan Popa <bogdan@defn.io>

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.