Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including connect-busboy with all npm packages installed. Try it out:

var connectBusboy = require("connect-busboy")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

connect-busboy v0.0.2

Connect middleware for busboy

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.busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
    // ...
  });
  req.busboy.on('field', function(key, value, keyTruncated, valueTruncated) {
    // ...
  });
  req.pipe(req.busboy);
  // 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, encoding, mimetype) {
    // ...
  });
  req.busboy.on('field', function(key, value, keyTruncated, valueTruncated) {
    // ...
  });
  // etc ...
});

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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free