Plug.MIME

Maps MIME types to file extensions and vice versa.

Summary

extensions(type)

Returns the extensions associated with a MIME type

path(path)

Guesses the MIME type based on the path’s extension

type(arg1)

Returns the MIME type associated with a file extension

valid?(type)

Returns whether a MIME type is registered

Functions

extensions(type)

Specs:

Returns the extensions associated with a MIME type.

iex> Plug.MIME.extensions("text/html")
["html", "htm"]
path(path)

Specs:

Guesses the MIME type based on the path’s extension.

iex> Plug.MIME.path("index.html")
"text/html"
type(arg1)

Specs:

Returns the MIME type associated with a file extension.

iex> Plug.MIME.type("txt")
"text/plain"
valid?(type)

Specs:

Returns whether a MIME type is registered.

iex> Plug.MIME.valid?("text/plain")
true