express-custom-mime-types

A middleware to send files with a user-defined mime type.

npm install express-custom-mime-types
10 downloads in the last week
26 downloads in the last month

This is a middleware to send files with a user-defined mime type.

Usage

The express-custom-mime-types package is simply a function, which accepts one parameter: options.

So far, options accepts one property: mimes. mimes is an associative array.

Each property of the associative array represents the file extension with the value being the mime-type.

In the following example, we have our express.js app serve *.underscore files as plain text.

var express = require('express');
var app = express();
app.configure(function () {
  // ...
  app.use(require('express-custom-mime-types')({
    mimes: {
      '.underscore': 'text/plain'
    }
  }));
  // ...
});
npm loves you