Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
The custom mime-typs utility can work with mime-db.
fork from mime-types, except:
mime = new Mime(require('mime-db'))
mime = require('mime-type/with-db')
directly, but firstnpm install mime-db
mime = new Mime()
business, so you could do lookup = mime.lookup.bind(mime)
..define()
functionality.glob()
functionality.exist(type)
functionality to check whether a mime-type is exist..extensions
will be deprecated, use mime[type].extensions
instead.undefined
if input is invalid or not found.Otherwise, the API is compatible.
$ npm install mime-type
var mime = require('mime-type')()
//or create an instance and load mime-db. you need `npm install mime-db`
var mime = require('mime-type/with-db')
All functions return undefined
if input is invalid or not found.
Lookup the content-type associated with a file.
mime.lookup('json') // 'application/json'
mime.lookup('.md') // 'text/x-markdown'
mime.lookup('file.html') // 'text/html'
mime.lookup('folder/file.js') // 'application/javascript'
mime.lookup('folder/.htaccess') // false
mime.lookup('cats') // false
Return all MIME types which matching a pattern
mime.glob('*/*') // 'application/json'
mime.lookup('.md') // 'text/x-markdown'
mime.lookup('file.html') // 'text/html'
mime.lookup('folder/file.js') // 'application/javascript'
mime.lookup('folder/.htaccess') // false
mime.lookup('cats') // false
Create a full content-type header given a content-type or extension.
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
mime.contentType('file.json') // 'application/json; charset=utf-8'
// from a full path
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
Get the default extension for a content-type.
mime.extension('application/octet-stream') // 'bin'
Lookup the implied default charset of a content-type.
mime.charset('text/x-markdown') // 'UTF-8'
A map of content-types by extension.
A map of extensions by content-type.
FAQs
the custom more powerful mime-type utility can work with mime-db.
The npm package mime-type receives a total of 5,166 weekly downloads. As such, mime-type popularity was classified as popular.
We found that mime-type demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.