A simple wrapper for mongodb gridfs bucket.
Function | Description |
---|---|
createGridFSBucket(db, options) | create a gridFS bucket object to store files into mongodb |
getGridFSBucketDb(bucket) | <p>getGridFSBucketDb returns mongodb Db instance which is used to create this bucket.</p><p>this not a wrapper of mongodb public native api, so use this method carefully</p> |
getGridFSBucketName(bucket) | <p>getGridFSBucketName returns the bucket’s name</p><p>this not a wrapper of mongodb public native api, so use this method carefully</p> |
getGridFSBucketOptions(bucket) | <p>getGridFSBucketDb returns mongodb gridFS bucket options which is used to create this bucket.</p><p>this not a wrapper of mongodb public native api, so use this method carefully</p> |
readFileById(bucket, id, options) | readFileById returns Buffer read from specified file stored in mongodb bucket by objectId |
readFileByName(bucket, fileName, options) | readFileByName returns Buffer read from specified file stored in mongodb bucket by fileName |
readFileWithStream(downloadStream) | readFileWithStream reads a file from gridFS bucket using the provided stream |
writeFileById(bucket, id, file, fileName, options) | readFileByName stores file into gridFS bucket by id |
writeFileByName(bucket, file, fileName, options) | readFileByName stores file into gridFS bucket by fileName |
writeFileWithStream(uploadStream, file) | writeFileWithStream store a file into gridFS bucket using the provided stream. This function will overwrite the |