Package Exports
- skipper
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 (skipper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Streaming Multipart File Upload Parsing
Skipper is an opinionated variant of Connect's body parser designed to support streaming upload of monolithic files to a compatible blob receiver, while still allowing application code to run in a timely manner; without writing .tmp files to disk.
This module
maywill be included as a part of the stable release of Sails v0.10. However we need help with documentation, examples, and writing additional receivers (currently receivers for S3 and local disk exist.) The decision to include skipper in v0.10 was tough-- it has stalled our release. However, it was a consequence of rewriting this module to use streams2, as well as the spotty/fragmented/confusing state of file uploads around the community. We hope this module helps clear things up for everypony.
Installation
npm install skipper --saveSetup
This module is a drop-in replacement for the Connect bodyParser which is currently used by default in Sails and Express. Therefore, we need to disable the default and hook up Skipper instead.
With Sails
In config/express.js:
// ...
bodyParser: require('skipper')
// ...With Express
In the file where you set up your middleware:
// ...
app.use(require('skipper')());
// ...Usage
req.file(foo) returns a stream of binary streams- one for each file that was uploaded to the specified parameter (foo) via an HTTP multipart file upload. As is true with most middleware, the usage is identical between Sails and Express.
With Sails
In one of your controller actions:
// ...
upload: function (req, res) {
var SomeReceiver = require('../receivers/someReceiver');
req.file('avatar').upload( SomeReceiver() , function (err, files) {
if (err) return res.serverError(err);
return res.json({
message: files.length + ' file(s) uploaded successfully!',
files: files
});
});
}
// ...With Express
app.post('/upload', function uploadAction (req, res) {
var SomeReceiver = require('./receivers/someReceiver');
req.file('avatar').upload( SomeReceiver() , function (err, files) {
if (err) return res.send(500, err);
return res.json({
message: files.length + ' file(s) uploaded successfully!',
files: files
});
});
});Status
Currently, this project is in beta, and openly released on npm. Development takes place on the master branch.
More Resources
- Stackoverflow
- #sailsjs on Freenode (IRC channel)
- Professional/enterprise
- Tutorials
- Waterline (ORM)
License
MIT © 2014 Mike McNeil, Scott Gress, Balderdash & contributors
This module is part of the Sails framework, and is free and open-source under the MIT License.

