Skip to main content
@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.

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.

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.

Predicates

Where it fits

@talosjs/http-mimes backs the type checks used by request.files (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.