JSPM

  • Created
  • Published
  • Downloads 72073784
  • Score
    100M100P100Q268608F

A super simple utility library for dealing with mime-types

Package Exports

  • mime
  • mime/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A library for doing simple mime-type lookups.

var mime = require('mime');

mime.lookup('/path/to/file.txt');         // => 'text/plain'
mime.lookup('file.txt');                  // => 'text/plain'
mime.lookup('.txt');                      // => 'text/plain'
mime.lookup('htm');                       // => 'text/html'

... and extension lookups by mime-type

mime.extension('text/html');                 // => 'html'
mime.extension('application/octet-stream');  // => 'bin'

It also includes rudimentary logic for determining charsets. (Useful in a web framework):

mime.charset.lookup('text/plain');        // => 'UTF-8'

Install with npm:

npm install mime