📝File GridFS
The module that handles the file system in the database (MongoDB).
Imports
Environment Variables
MONGODB_GRIDFS_NAME
The mongodb database gridfs name.
MONGODB_NAME
The mongodb database name.
Write .env
file with environment variable. Below has an example:
Method of Use
To use this module, you need to inject it into the desired service.
Injecting the module into our service.
Get a example file to test.
With dependencies
You will need to inject the following interfaces.
IConfigurationService
IValidatorRegexpService
IStringExService
IMongoDBService
IDebugService
Properties
get dbName
private
Return database name.
Methods
openUploadStream
public
Open Stream(GridFSBucketWriteStream) for writing data in database.
openDownloadStream
public
Open Stream(GridFSBucketReadStream) for reading data in database.
getDownloadStream
public
Return Stream(GridFSBucketReadStream) for reading data in database.
getVersion
public
Return version of file in database.
rename
public
Rename file in database.
delete
public
Delete file in database.
Last updated