2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-05-31 22:43:48 +00:00
|
|
|
// This module is browser compatible.
|
|
|
|
|
2024-05-15 06:33:05 +00:00
|
|
|
/**
|
|
|
|
* Utility functions for media types (MIME types).
|
2022-05-31 22:43:48 +00:00
|
|
|
*
|
2024-05-15 06:33:05 +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
|
2024-01-31 22:19:46 +00:00
|
|
|
* {@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
|
2024-05-15 06:33:05 +00:00
|
|
|
* {@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
|
2024-06-21 15:11:31 +00:00
|
|
|
* import { contentType, allExtensions, getCharset } from "@std/media-types";
|
refactor(assert,async,bytes,cli,collections,crypto,csv,data-structures,datetime,dotenv,encoding,expect,fmt,front-matter,fs,html,http,ini,internal,io,json,jsonc,log,media-types,msgpack,net,path,semver,streams,testing,text,toml,ulid,url,uuid,webgpu,yaml): import from `@std/assert` (#5199)
* refactor: import from `@std/assert`
* update
2024-06-30 08:30:10 +00:00
|
|
|
* import { assertEquals } from "@std/assert";
|
2024-03-16 22:05:59 +00:00
|
|
|
*
|
2024-06-21 15:11:31 +00:00
|
|
|
* assertEquals(allExtensions("application/json"), ["json", "map"]);
|
2024-05-15 06:33:05 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2022-12-19 10:02:14 +00:00
|
|
|
export * from "./content_type.ts";
|
|
|
|
export * from "./extension.ts";
|
2024-06-21 15:11:31 +00:00
|
|
|
export * from "./all_extensions.ts";
|
2022-12-19 10:02:14 +00:00
|
|
|
export * from "./format_media_type.ts";
|
|
|
|
export * from "./get_charset.ts";
|
|
|
|
export * from "./parse_media_type.ts";
|
2023-11-29 09:00:04 +00:00
|
|
|
export * from "./type_by_extension.ts";
|