Skip to content

willhuang85/skipper-gridfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

skipper emblem - face of a ship's captain GridFS Filesystem Adapter

NPM version     Build Status

GridFS adapter for receiving upstreams. Particularly useful for handling streaming multipart file uploads from the Skipper body parser.

Currently only supports Node 6 and up

========================================

Installation

$ npm install skipper-gridfs --save

Also make sure you have skipper installed as your body parser.

Skipper is installed by default in Sails v0.10.

========================================

Usage

req.file('avatar')
.upload({
  adapter: require('skipper-gridfs'),
  uri: 'mongodb://username:password@myhost.com:27017/myDatabase'
}, function whenDone(err, uploadedFiles) {
  if (err) return res.negotiate(err);
  else return res.ok({
    files: uploadedFiles,
    textParams: req.params.all()
  });
});

For more detailed usage information and a full list of available options, see the Skipper docs, especially the section on "Uploading to GridFS".

Option Type Details
uri ((string)) URI to connect to Mongo instance, e.g. mongodb://username:password@localhost:27107/databasename.
(Check mongo client URI syntax).
bucketOptions ((object)) An optional parameter that matches the GridFSBucket options (Check mongo gridfs bucket options).
mongoOptions ((object)) An optional paramter that matches the MongoClient.connect options (Check mongo client options).

========================================

Contributions

are welcomed 👌

See ROADMAP.md.

To run the tests:

$ URI=mongodb://username:password@localhost:27107/databasename npm test

========================================

License

MIT