connect-busboy

Connect middleware for busboy

npm install connect-busboy
43 downloads in the last day
186 downloads in the last week
1 204 downloads in the last month

Description

Connect middleware for busboy.

Requirements

Install

npm install connect-busboy

Example

var busboy = require('connect-busboy');

// default options, no immediate parsing
app.use(busboy());
// ...
app.use(function(req, res) {
  req.pipe(req.busboy);
  req.busboy.on('file', function(fieldname, file, filename) {
    // ...
  });
  // etc ...
});

// default options, immediately start reading from the request stream and
// parsing
app.use(busboy({ immediate: true }));
// ...
app.use(function(req, res) {
  req.busboy.on('file', function(fieldname, file, filename) {
    // ...
  });
  // etc ...
});

// any valid Busboy options can be passed in also
app.use(busboy({
  highWaterMark: 2 * 1024 * 1024,
  limits: {
    fileSize: 10 * 1024 * 1024
  }
}));
npm loves you