Parses the media type and any optional parameters, per
RFC 1521. Media types are
the values in Content-Type and Content-Disposition headers. On success
the function returns a tuple where the first element is the media type and
the second element is the optional parameters or undefined if there are
none.
The vendor folder contains copy of the
jshttp/mime-dbdb.json file along with
its license.
contentType()
Given a extension or media type, return a fully qualified header value for
setting a Content-Type or Content-Disposition header. The function will
process the value passed as a media type if it contains a /, otherwise will
attempt to match as an extension, with or without the leading ..
Note: a side effect of deno/x/media_types was that you could pass a file
name (e.g. file.json) and it would return the content type. This behavior is
intentionally not supported here. If you want to get an extension for a file
name, use extname() from std/path/mod.ts to determine the extension and
pass it here.
Given a media type and optional parameters, return a spec compliant value. If
the parameters result in a non-compliant value, an empty string ("") is
returned.