
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
lighter-mime
Advanced tools
The lighter-mime
module combines speed and support by immediately loading a
basic set of MIME types, and lazily loading a full set.
From your project directory, install and save as a dependency:
npm install --save lighter-mime
The lighter-mime
package exports an object whose keys are lowercase file
extensions and values are MIME types.
The basic mapping is pretty simple:
var mime = require('lighter-mime')
console.log(mime)
//> { css: 'text/css',
// gif: 'image/gif',
// html: 'text/html',
// ico: 'image/x-icon',
// jpg: 'image/jpg',
// js: 'application/javascript',
// json: 'application/json',
// png: 'image/png',
// svg: 'image/svg+xml',
// txt: 'text/plain',
// xml: 'application/xml' }
Set or overwrite a MIME type mapping for a given extension.
var mime = require('lighter-mime')
console.log(mime.js)
//> 'application/javascript'
// Let's consider JavaScript to be text.
mime.set('js', 'text/javascript')
console.log(mime.js)
//> 'text/javascript'
Load the comprehensive list immediately (and return the mapping).
var mime = require('lighter-mime').load()
console.log(mime.docx)
//> 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
Delay loading the comprehensive list for a specified number of milliseconds, rather than the default 1 millisecond.
v1.0.0 - 2015-12-01
major
First release.FAQs
A lightweight JavaScript MIME type library.
We found that lighter-mime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.