mrmime is a minimalist and high-performance utility designed to retrieve MIME types from file extensions or filenames. Currently at version 2.0.1, it offers a small footprint (2.8kB gzipped) and O(1) lookup times, making it significantly faster than alternatives like `mime` or `mime/lite` as demonstrated in its benchmarks. The library's comprehensive dictionary is generated from `mime-db`, which aggregates IANA, NGINX, and Apache datasets, ensuring accuracy for standard MIME types while intentionally omitting experimental and vendor-specific entries to maintain its lightweight nature. It supports both native ESM and CommonJS environments, including Deno, and allows for dictionary customization. The project maintains an active release cadence, primarily syncing with `mime-db` updates and addressing minor breaking changes between major versions.
npm install mrmimeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to lookup MIME types for various inputs, handle unknown extensions, and dynamically customize the internal MIME dictionary.
Update type assertions or nullish coalescing logic to explicitly check for `undefined` instead of `void`.
Verify that expected MIME types for specific extensions are still correct after upgrading. If a previously recognized type is now `undefined` or changed, update application logic or manually add/override the type in the `mimes` dictionary.
Upgrade to `mrmime` v1.0.1 or newer to ensure correct TypeScript type discovery.
If using `require`, use `const { lookup } = require('mrmime');`. If in an ES module environment, ensure `import { lookup } from 'mrmime';` is used and the file is treated as an ES module (e.g., `.mjs` extension or `type: 'module'` in `package.json`).Recognize that `lookup` returns `undefined` for unknown extensions. If the extension is valid for your application, add it to the `mimes` dictionary: `mimes['xyz'] = 'your/custom-type';`.
No dependency data recorded yet.