Constructor for a streaming GridFS interface
Constructor for a streaming GridFS interface
the Db
the options
a new GridFSBucket
Deletes a file with the given id
Deletes a file with the given id
the id of the file doc
the optional callback function
a completion promise if no callback function was passed
delete(id[, callback])
Removes this bucket's files collection, followed by its chunks collection.
Removes this bucket's files collection, followed by its chunks collection.
the optional callback function
a completion promise if no callback function was passed
drop(callback)
Convenience wrapper around find on the files collection
Convenience wrapper around find on the files collection
find(filter, options)
Returns a readable stream (GridFSBucketReadStream) for streaming file data from GridFS.
Returns a readable stream (GridFSBucketReadStream) for streaming file data from GridFS.
the id of the file document
the download options
openDownloadStream(id, options)
Returns a readable stream (GridFSBucketReadStream) for streaming the file with the given name from GridFS.
Returns a readable stream (GridFSBucketReadStream) for streaming the file with the given name from GridFS. If there are multiple files with the same name, this will stream the most recent file with the given name (as determined by the uploadDate field). You can set the revision option to change this behavior.
the name of the file to download
the download options
bucket.openDownloadStreamByName('meistersinger.mp3')
Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS.
Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS. The stream's 'id' property contains the resulting file's id.
the name of the file to download
the upload options
bucket.openUploadStream('./meistersinger.mp3')
Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS for a custom file id.
Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS for a custom file id. The stream's 'id' property contains the resulting file's id.
A custom id used to identify the file
The value of the 'filename' key in the files doc
Optional settings.
GridFS Bucket