Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A super simple utility library for dealing with mime-types

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 debian
Octocat-spinner-32 index.js
Octocat-spinner-32 mime.js
Octocat-spinner-32 mime.types
Octocat-spinner-32 node.types
Octocat-spinner-32 package.json
Octocat-spinner-32 test.js

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');  // => 'buffer'

'Need to define your own types? Just load up an Apache-format 'types' file (see mime.types or node.types for an example). Your types are "overlaid" onto the default mime.types and node.types.


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
Something went wrong with that request. Please try again.