> ## Documentation Index
> Fetch the complete documentation index at: https://docs.talosjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HTTP MIMEs

> Complete MIME type registry with TypeScript constants and lookup utilities for content type negotiation and file type detection.

`@talosjs/http-mimes` ships a `MIME` constant with the full IANA MIME type registry (thousands of entries, from `application/json` to `x-shader/x-vertex`), a `MimeType` union type generated from it, and a `Mime` helper class with dozens of `isXxx(mime)` predicates for the content types you actually check for day to day — JSON, images, audio/video, office documents, archives, and more.

## Installation

Add the package with Bun.

```bash theme={null}
bun add @talosjs/http-mimes
```

## Usage

### The registry

`MIME` is a `readonly` array of every known MIME type string; `MimeType` is the union type derived from it, useful for validating or narrowing a content type value.

```typescript theme={null}
import { MIME } from "@talosjs/http-mimes";
import type { MimeType } from "@talosjs/http-mimes";

MIME.includes("application/json"); // true

const contentType: MimeType = "image/png"; // typed against the registry
```

### The `Mime` helper

`Mime` implements `IMime`, a set of boolean predicates for common MIME categories. Each method lower-cases and trims its input before matching, so callers don't need to normalize the value themselves.

```typescript theme={null}
import { Mime } from "@talosjs/http-mimes";

const mime = new Mime();

mime.isJson("application/json; charset=utf-8"); // true
mime.isImage("image/png");                      // true
mime.isPdf("application/pdf");                   // true
mime.isMultipart("multipart/form-data");         // true
mime.isVideo("video/mp4");                       // true
```

## Predicates

| Method             | Matches                                                                                                |
| ------------------ | ------------------------------------------------------------------------------------------------------ |
| `isJson`           | `application/json`, `application/ld+json`, `application/json5`, `text/json`, and related JSON variants |
| `isAudio`          | Any `audio/*` type                                                                                     |
| `isVideo`          | Any `video/*` type                                                                                     |
| `isMp4`            | `video/mp4`                                                                                            |
| `isMp3`            | `audio/mpeg`                                                                                           |
| `isSvg`            | `image/svg+xml`                                                                                        |
| `isJpeg` / `isJpg` | JPEG images                                                                                            |
| `isPng`            | PNG images                                                                                             |
| `isGif`            | GIF images                                                                                             |
| `isWebp`           | WebP images                                                                                            |
| `isImage`          | Any `image/*` type                                                                                     |
| `isCsv`            | `text/csv`                                                                                             |
| `isPdf`            | `application/pdf`                                                                                      |
| `isHtml`           | `text/html`                                                                                            |
| `isCss`            | `text/css`                                                                                             |
| `isJavaScript`     | JavaScript MIME variants                                                                               |
| `isXml`            | XML MIME variants                                                                                      |
| `isText`           | `text/*`                                                                                               |
| `isPlainText`      | `text/plain`                                                                                           |
| `isMarkdown`       | `text/markdown`, `text/x-markdown`                                                                     |
| `isRtf`            | `application/rtf`                                                                                      |
| `isZip`            | `application/zip`                                                                                      |
| `isGzip`           | `application/gzip`, `application/x-gzip`                                                               |
| `isFont`           | Font MIME types                                                                                        |
| `isWord`           | Microsoft Word document types                                                                          |
| `isExcel`          | Microsoft Excel document types                                                                         |
| `isPowerPoint`     | Microsoft PowerPoint document types                                                                    |
| `isOctetStream`    | `application/octet-stream`                                                                             |
| `isBlob`           | `application/octet-stream`                                                                             |
| `isStream`         | `application/octet-stream`, `application/stream`                                                       |
| `isFormData`       | `application/form-data`                                                                                |
| `isForm`           | `application/x-www-form-urlencoded`                                                                    |
| `isMultipart`      | Any `multipart/*` type                                                                                 |

## Where it fits

`@talosjs/http-mimes` backs the type checks used by [`request.files`](/basics/request) (each `IRequestFile` exposes format detection built on `Mime`) and anywhere else the framework or your code needs to branch on a content type — validating an upload, picking a parser, or deciding how to render a response. Reach for it directly whenever your own code needs the same checks without depending on the request or storage layers.
