Skip to content

mime-types-lite

Tiny, zero-dependency, type-safe MIME constants and helpers for HTTP APIs, uploads, and file extensions.

Tiny, zero-dependency, type-safe MIME constants and helpers for HTTP APIs, uploads, and file extensions.

What it is

A small, zero-dependency TypeScript library of MIME constants and helpers for HTTP APIs, uploads, and file extensions.

The problem

Upload, download, and HTTP code needs dependable mappings between filenames or extensions and media types. Carrying a broad MIME database into every bundle for that job adds weight most applications do not need.

What it delivers

  • Consumers can infer common media types from filenames.
  • Consumers can recover the preferred extension for a media type.
  • Media-type inputs can be validated and normalized before use.
  • The same API works in browser and Node.js module systems.

Limits to know

  • One extension can have aliases or ambiguous mappings.
  • Lookup must normalize case, dots, and paths without implying that file content was inspected.
  • ESM and CommonJS consumers need stable typed exports with no runtime dependencies.

Status and role

  • Status: Published npm package
  • My role: Library design and package engineering
  • Scope: Typed APIs, compatibility, and package distribution

Project stack

  • TypeScript
  • ESM
  • CommonJS
  • tsup
  • TanStack Start
  • React
  • Tailwind CSS
  • Vite
  • Netlify
  • GitHub Actions
  • CI/CD
  • System Design

Need help with this project? Get project support

Working through something similar?

Share your challenge, scope, and timeline to start a focused conversation.

Discuss a project