Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 24, 2024 via pnpm

mime-types 2.1.35

The ultimate javascript content-type utility.
Package summary
Share
0
issues
1
license
2
MIT
Package created
2 May 2014
Version published
12 Mar 2022
Maintainers
2
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
mime-db@1.52.0
mime-types@2.1.35
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of mime-types 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
mime-db1.52.026.36 kBMIT
prod

Visualizations

Frequently Asked Questions

What does mime-types do?

Mime-types is a content-type utility in JavaScript. It precisely offers its services due to its feature of not falling back naively to the first available type. Instead, when a file type is unrecognized, it returns 'false'. It is a node.js module available via npm registry and all its types are rooted in mime-db. It provides various API functionalities such as looking up the content-type associated with a file, creating a full content-type header given an extension or content-type, fetching the default extension for a content-type, checking the implied default charset of a content-type, and more.

How do you use mime-types?

Usage of mime-types is fairly straightforward after you've installed it using the npm install command npm install mime-types. Post-installation, you can require it in your JavaScript file with the following command var mime = require('mime-types'). The various functions provide different use cases:

  • Looking up a content-type:
mime.lookup('json'); //returns 'application/json'
  • Creating a full content-type header from an extension or content-type:
mime.contentType('markdown'); //returns 'text/x-markdown; charset=utf-8'
  • Getting the default extension for a content-type:
mime.extension('application/octet-stream'); //returns 'bin'
  • Looking up the implied default charset of a content-type:
mime.charset('text/markdown'); //returns 'UTF-8'
  • A map of content-types by extension can be found at mime.types[extension] and a map of extensions by content-type at mime.extensions[type].

Where are the mime-types docs?

Mime-types documentation can be found on the project's GitHub page at https://github.com/jshttp/mime-types. The readme file on the project's GitHub page offers detailed understanding of mime-types, covering different aspects like installation, usage and API. It should be your go-to guide for any queries regarding the usage of this package.