Home > gridfs-extra > readFileByName
readFileByName returns Buffer read from specified file stored in mongodb bucket by fileName
Signature:
declare function readFileByName(bucket: mongodb.GridFSBucket, fileName: string, options?: mongodb.GridFSBucketReadStreamOptionsWithRevision | undefined): Promise<Buffer>;
Parameter | Type | Description |
---|---|---|
bucket | mongodb.GridFSBucket | a mongodb gridFS bucket |
fileName | string | name of file to read |
options | mongodb.GridFSBucketReadStreamOptionsWithRevision | undefined | (Optional) options for opening download stream |
Returns:
Promise<Buffer>
a promise that resolves to a Buffer