JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5119
  • Score
    100M100P100Q128815F

A streaming multipart parser

Package Exports

  • parted

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parted) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parted

Parted is a streaming multipart parser.

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);