Connect compatible multipart middleware configured to stream uploads directly to MongoDB GridFS.
npm install connect-multipart-gridform
var multipart = ;app;
Options work the same way as in the connect multipart middleware, with these additions:
- db: (required) an open node-mongodb-native db instance
- mongo: (required) the node-mongodb-native driver you created the db with
- filename: (optional) function
filename function is passed the
file.name before streaming to MongoDB providing an opportunity to customize the filename with a prefix etc.
For the curious, the options are first passed into a gridform before passing on to connects multiple middleware.
Connect multipart middleware uses formidable to process file uploads.
formidable streams the files to disk. Now you can stream directly into GridFS.
var multipart = require('connect-multipart-gridform'); var gridform = multipart.gridform; var connectMultipart = multipart.multipart;
Run the tests with
Currently only works with Express 3.