mongoose-blob-store

1.0.0 • Public • Published

mongoose-blob-store

store blobs using mongoose gridfs

npm version Build Status

blob-store-compatible

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

/mongoose-blob-store/

    Package Sidebar

    Install

    npm i mongoose-blob-store

    Weekly Downloads

    6

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    17.3 kB

    Total Files

    4

    Last publish

    Collaborators

    • lwhiteley