Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Micro npm Packages
  3. node-mime

node-mime

MITTypeScriptv4.1.0

A comprehensive, dependency-free JavaScript library for MIME type and file extension mapping.

GitHubGitHub
2.4k stars322 forks0 contributors

What is node-mime?

Mime is a JavaScript library that provides a comprehensive API for mapping between file extensions and MIME types. It solves the problem of accurately determining content types for files in web applications, servers, and build tools, ensuring proper handling and serving of diverse file formats.

Target Audience

Node.js and JavaScript developers building web servers, file processing utilities, static site generators, or any application that needs to infer or set MIME types based on file extensions.

Value Proposition

Developers choose Mime for its completeness (covering all `mime-db` types), zero dependencies, and straightforward API, making it a reliable and lightweight alternative to larger or less maintained MIME type libraries.

Overview

Mime types for JavaScript

Use Cases

Best For

  • Web servers that need to set accurate Content-Type headers
  • Build tools that process and serve static assets
  • File upload handlers validating or inferring file types
  • CLI utilities that work with file extensions and MIME types
  • Applications requiring a lightweight, dependency-free MIME type solution
  • Projects migrating from `mime@3` to a modern, ESM-compatible version

Not Ideal For

  • Projects in non-JavaScript environments (e.g., Python, Go) needing MIME type handling
  • Applications requiring MIME type detection from file content rather than extensions
  • Legacy Node.js projects stuck on CommonJS or pre-ES2020 runtimes
  • Systems with extreme bundle size constraints where only a handful of MIME types are needed

Pros & Cons

Pros

Comprehensive Type Coverage

Includes all mime-db types with over 800 MIME types and 1,000+ extensions, ensuring support for virtually any file format in web and server contexts.

Zero Dependencies

Has no external dependencies, resulting in minimal bundle size and avoiding dependency conflicts or bloat common in other libraries.

Built-in TypeScript Support

Provides full TypeScript types out of the box, eliminating the need for separate @types packages and enhancing developer experience with auto-completion.

Lite Version Flexibility

Offers a drop-in lite version that excludes unofficial types (e.g., 'prs.*', 'x-*'), allowing for smaller builds when full coverage isn't required.

Cons

Breaking API Changes

Version 4 introduces breaking changes from v3, such as no direct property imports and an immutable default object, which can disrupt upgrades and require code adjustments.

ESM-Only Restriction

Requires ESM module support and ES2020 runtime, limiting compatibility with older CommonJS-based projects or environments without modern JavaScript support.

No Content Analysis

Only maps file extensions to MIME types and cannot detect types from file content, making it unsuitable for files without extensions or with mismatched data.

Frequently Asked Questions

Quick Stats

Stars2,355
Forks322
Contributors0
Open Issues0
Last commit2 days ago
CreatedSince 2010

Tags

#dependency-free#nodejs#typescript#javascript-library#mime-types#web-development

Built With

J
JavaScript
T
TypeScript

Included in

Micro npm Packages4.6k
Auto-fetched 1 day ago

Related Projects

nanoidnanoid

A tiny (118 bytes), secure, URL-friendly, unique string ID generator for JavaScript

Stars26,749
Forks842
Last commit9 days ago
uuiduuid

Generate RFC-compliant UUIDs in JavaScript

Stars15,262
Forks951
Last commit5 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub