{"library":"mime-names","title":"MIME Type Names Database","description":"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.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install mime-names"],"cli":null},"imports":["import db from 'mime-names';","const db = require('mime-names');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import db from 'mime-names';\n\nconst mimeType = 'application/json';\nconst data = db[mimeType];\n\nif (data) {\n  console.log(`MIME Type: ${mimeType}`);\n  console.log(`  Name: ${data.name}`);\n  console.log(`  Extensions: ${data.extensions ? data.extensions.join(', ') : 'None'}`);\n} else {\n  console.log(`No data found for MIME type: ${mimeType}`);\n}\n\nconst unknownMimeType = 'application/x-custom-type';\nconst unknownData = db[unknownMimeType];\nif (!unknownData) {\n  console.log(`\\nAs expected, no data for ${unknownMimeType} (not all-encompassing).`);\n}\n","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}