---
title: "@std/media-types"
description: "Utility functions for media types (MIME types)"
jsr: jsr:@std/media-types
pkg: media-types
version: 1.1.0
generated: true
stability: stable
---
<!-- Autogenerated from JSR docs. Do not edit directly. -->

## Overview

<p>Utility functions for media types (MIME types).</p>
<p>This API is inspired by the GoLang <a href="https://pkg.go.dev/mime" rel="nofollow"><code>mime</code></a>
package and <a href="https://github.com/jshttp/mime-types" rel="nofollow">jshttp/mime-types</a>,
and is designed to integrate and improve the APIs from
<a href="https://deno.land/x/media_types" rel="nofollow">x/media_types</a>.</p>
<p>The <code>vendor</code> folder contains copy of the
<a href="https://github.com/jshttp/mime-types" rel="nofollow">jshttp/mime-db</a> <code>db.json</code> file,
along with its license.</p>

```js
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");
```

### Add to your project

```sh
deno add jsr:@std/media-types
```

<a href="https://jsr.io/@std/media-types/doc" class="docs-cta jsr-cta">See all symbols in @std/media-types on
<svg class="inline ml-1" viewBox="0 0 13 7" aria-hidden="true" height="20"><path d="M0,2h2v-2h7v1h4v4h-2v2h-7v-1h-4" fill="#083344"></path><g fill="#f7df1e"><path d="M1,3h1v1h1v-3h1v4h-3"></path><path d="M5,1h3v1h-2v1h2v3h-3v-1h2v-1h-2"></path><path d="M9,2h3v2h-1v-1h-1v3h-1"></path></g></svg></a>

<!-- custom:start -->
<!-- Add persistent custom content below. This section is preserved across generations. -->

<!-- custom:end -->
