Utility functions for media types (MIME types).
This API is inspired by the GoLang mime package and jshttp/mime-types, and is designed to integrate and improve the APIs from x/media_types.
mime
The vendor folder contains copy of the jshttp/mime-db db.json file, along with its license.
vendor
db.json
import { contentType, allExtensions, getCharset } from "@std/media-types";import { assertEquals } from "@std/assert";assertEquals(allExtensions("application/json"), ["json", "map"]);assertEquals(contentType(".json"), "application/json; charset=UTF-8");assertEquals(getCharset("text/plain"), "UTF-8"); Copy
import { contentType, allExtensions, getCharset } from "@std/media-types";import { assertEquals } from "@std/assert";assertEquals(allExtensions("application/json"), ["json", "map"]);assertEquals(contentType(".json"), "application/json; charset=UTF-8");assertEquals(getCharset("text/plain"), "UTF-8");
Utility functions for media types (MIME types).
This API is inspired by the GoLang
mimepackage and jshttp/mime-types, and is designed to integrate and improve the APIs from x/media_types.The
vendorfolder contains copy of the jshttp/mime-dbdb.jsonfile, along with its license.