Nestjs File Storage With GridFS

Alaa Al-wattar
1 min readJun 10, 2019

--

start by adding “multer-gridfs-storage” repository

npm i --save multer-gridfs-storage @types/multer-gridfs-storage

now we need to create Multer configuration service to provide GridFS as storage option:

Note: ConfigService injected just as an example here you should use your own configuration or environment variables provider.

Now we can register MulterModule in our module definition using the configuration service class.

that is all we need to do now we can use Multer decorators in our controller as usual Nestjs will take care of the rest.

--

--