std/media_types/mod.ts

37 lines
1.2 KiB
TypeScript
Raw Normal View History

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2022-05-31 22:43:48 +00:00
// This module is browser compatible.
/**
* Utility functions for media types (MIME types).
2022-05-31 22:43:48 +00:00
*
* This API is inspired by the GoLang {@linkcode https://pkg.go.dev/mime | mime}
* package and {@link https://github.com/jshttp/mime-types | jshttp/mime-types},
* and is designed to integrate and improve the APIs from
* {@link https://deno.land/x/media_types | x/media_types}.
2022-11-25 11:40:23 +00:00
*
* The `vendor` folder contains copy of the
* {@link https://github.com/jshttp/mime-types | jshttp/mime-db} `db.json` file,
* along with its license.
2022-05-31 22:43:48 +00:00
*
2024-03-16 22:05:59 +00:00
* ```ts
* import { contentType, allExtensions, getCharset } from "@std/media-types";
* import { assertEquals } from "@std/assert";
2024-03-16 22:05:59 +00:00
*
* assertEquals(allExtensions("application/json"), ["json", "map"]);
*
* assertEquals(contentType(".json"), "application/json; charset=UTF-8");
*
* assertEquals(getCharset("text/plain"), "UTF-8");
2024-03-16 22:05:59 +00:00
* ```
*
2022-05-31 22:43:48 +00:00
* @module
*/
export * from "./content_type.ts";
export * from "./extension.ts";
export * from "./all_extensions.ts";
export * from "./format_media_type.ts";
export * from "./get_charset.ts";
export * from "./parse_media_type.ts";
export * from "./type_by_extension.ts";