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