GithubHelp home page GithubHelp logo

skipper-gridfs's Introduction

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.

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

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://jimmy@[email protected]:27017/coolapp.avatar_uploads'
}, 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".

One important adapter-specific option to note is uri:

Option Type Details
uri ((string)) An optional parameter if you wish the enter your mongodb credentials as a URI, e.g. mongodb://username:password@localhost:27107/databasename.bucket.
(Check mongo client URI syntax).
connectOpts ((object)) An optional parameter if you wish the enter your mongodb connection options credentials as an object e.g. { server: { ssl: true, sslCA: 'CA_CERT', sslKey: 'SSL_KEY', sslCert: 'SSL_CERT' }, replSet: { rs_name: 'rs0', ssl:true} }
(Check mongo client connection options).

Note: Please use uri instead of passing in separate options for username, password, host, port, dbname and bucket

In addition to the regular file adapter methods, these additional methods are also available:

Method Description
readLastVersion() Get the most recent version of a file in GridFS
readVersion() Get a specific version of a file in GridFS

These methods mimic get_last_version and get_version from pymongo's gridfs implementation.

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

Contributions

are welcomed ๐Ÿ‘Œ

See ROADMAP.md.

Also be sure to check out ROADMAP.md in the Skipper repo.

To run the tests:

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

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

License

MIT

skipper-gridfs's People

Contributors

willhuang85 avatar mikermcneil avatar marcelomedina10 avatar frostme avatar fshowalter avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.