mime-lite provides a lightweight, standard set of MIME type mappings for JavaScript applications, suitable for both Node.js and browser environments. The current stable version is 1.0.3, with a release cadence that appears to be low but active, incorporating updates for new MIME types as needed (e.g., adding 'xls' in v1.0.3). Its key differentiator is being a 'lite' version, implying a smaller bundle size and a focused set of standard MIME type definitions compared to larger, more comprehensive libraries like the original `mime` package, from which it acknowledges copying its data. This makes it an efficient choice for projects where minimizing footprint is critical. It ships with TypeScript types, enhancing developer experience and type safety.
npm install mime-liteVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `getType` and `getExtension` to determine MIME types from extensions and vice versa, including a simple validation example.
Consult `mime-lite` source or test specific types for support. For broader coverage, consider the full `mime` package or a more comprehensive registry.
Implement nullish coalescing (`??`) or conditional checks (`if (mimeType)`) when consuming the results of `getType` or `getExtension`.
Always use ESM `import { namedExport } from 'mime-lite';` for best compatibility and type support in modern projects. Ensure your `tsconfig.json` and build setup are configured for ESM.Use `import { getType } from 'mime-lite';` for ESM projects. If using CommonJS, try `const { getType } = require('mime-lite');` or ensure your transpiler correctly handles interop.Ensure the package is installed: `npm install mime-lite` or `yarn add mime-lite`. If types are missing, explicitly install `@types/mime-lite` if available, though `mime-lite` ships its own types.
No dependency data recorded yet.