mongoose-blob-store
v1.0.0
Published
store blobs using mongoose gridfs
Downloads
41
Maintainers
Readme
mongoose-blob-store
store blobs using mongoose gridfs
compatible with the abstract-blob-store API and passes its test suite
eg. Usage
Please note that the configuration has a breaking change since v0.*
const store = require('mongoose-blob-store');
// connect mongoose to mongo db then use the connection
const mongooseConnection = require('mongoose').connection;
const blobStorage = store({
mongooseConnection,
collection: 'attachments',
modelName: 'Attachment',
});
//write
blobStorage.createWriteStream(opts, cb);
//read
const stream = blobStorage.createReadStream(opts);
//remove
blobStorage.remove(opts, cb);
//check if file exists
blobStorage.exists(opts, cb);
pull requests are welcome