Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Streaming body parser for node.js.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.md
index.js
package.json

README.md

parted

Parted is a streaming multipart parser. It eventually intends to be a completely streaming request body parser for URL encoded messages, JSON, along with multipart. The QS and JSON parsers are currently included, but they're somewhat experimental.

Usage

var parted = require('parted');

var parser = new parted(type, options)
  , parts = {};

parser.on('error', function(err) {
  req.destroy();
  next(err);
});

parser.on('part', function(field, part) {
  // temporary path or string
  parts[field] = part; 
});

parser.on('data', function(bytes) {
  console.log('%d bytes written.', this.written);
});

parser.on('end', function() {
  console.log(parts);
});

req.pipe(parser);

As a middleware

var parser = parted.middleware({ 
  path: __dirname + '/uploads' 
});
app.use(parser);
Something went wrong with that request. Please try again.