Skip to content

mime-types-lite

packageLast commit

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

Role
Library design and package engineering
Scope
Typed APIs, compatibility, and package distribution
Status
Published npm package
mime-types-lite interface preview

Problem

Upload, download, and HTTP code needs dependable mappings between filenames/extensions and media types without carrying a broad database dependency into every bundle.

Constraints

  1. C1

    One extension can have aliases or ambiguous mappings.

  2. C2

    Lookup must normalize case/dots/paths without pretending file content was inspected.

  3. C3

    ESM/CommonJS consumers require stable typed exports with no runtime dependencies.

Architecture

Curated media-type registry and pure lookup/validation functions; tsup dual-format package/exports; workspace-linked TanStack Start docs and playground.

01

Core library

Curated media-type registry and pure lookup/validation functions.

02

Package builds

Tsup dual-format package/exports.

03

Documentation app

Workspace-linked TanStack Start docs and playground.

Decisions

D1

Scope the registry/helpers narrowly and keep zero dependencies

Scope the registry/helpers narrowly and keep zero dependencies.

D2

Treat extension lookup as metadata inference not content security validation

Treat extension lookup as metadata inference, not content security validation.

D3

Exercise the exact local package from the documentation app before release

Exercise the exact local package from the documentation app before release.

Contribution

  • Implemented extension-to-type and type-to-extension lookups.
  • Added normalization and validation helpers.
  • Configured typed ESM/CommonJS publishing.
  • Built interactive docs, examples, tests, CI, and Netlify deployment.

Outcomes

  • Consumers can infer common media types from filenames.
  • Recover preferred extensions.
  • Validate/normalize media-type inputs.
  • Use the same API in browser/Node module systems.

Product screenshot

mime-types-lite interface preview
mime-types-lite presents tiny, zero-dependency, type-safe MIME constants and helpers for HTTP APIs, uploads, and file extensions.

Verified stack

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

Working through something similar?

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