mime-names is a JavaScript package that provides a database of human-readable names and common file extensions, keyed by MIME types. It is designed to complement `mime-db`, offering a more descriptive layer on top of MIME type definitions. This package does not aim to be an exhaustive list of all MIME types, focusing instead on popular and commonly used formats. Developers should anticipate that some less common MIME types might not be present and implement graceful handling for such cases. The current stable version is 1.0.0, and releases are typically made as needed to add new types or update existing data. Its primary differentiator is its direct, lookup-table structure and its specific focus on human-readable names and extensions rather than broader MIME type resolution logic.
npm install mime-namesVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the MIME database and look up information for a specific MIME type, including handling cases where a type might not be found. It illustrates accessing the name and extensions properties.
Always check if the lookup result is `undefined` before trying to access its properties. E.g., `const data = db[mimeType]; if (data) { /* use data */ }`Avoid directly adding, deleting, or modifying properties on the `db` object. If custom MIME type data is needed, merge it into a separate, application-specific object.
Ensure that the MIME type entry is not `undefined` before accessing its properties. `const data = db[mimeType]; if (data) { console.log(data.name); }`Use a default import to get the entire database object: `import db from 'mime-names';`. The package does not offer individual named exports for specific MIME types or utility functions.
No dependency data recorded yet.