-
Notifications
You must be signed in to change notification settings - Fork 72
Using Typescript
Rafael edited this page May 12, 2017
·
2 revisions
Typings for this module can be installed using npm
$ npm install @types/multer-gridfs-storage --saveWhen using typescript the module export a class definition
named MulterGridfsStorage.
You can use import and write your own name for it
import * as GridFSStorage from 'multer-gridfs-storage';let gfsCtr = new GridFSStorage({ ... });It also exports two interfaces that can be used for the options object
The GfsStorageOptions interface requires a gfs property expecting a
Promise<Grid> or a Grid object installable from @types/gridfs-stream.
let opts: GridFSStorage.GfsStorageOptions;
opts = {
gfs: ...
};The UrlStorageOptions interface requires a url property expecting a string.
let opts: GridFSStorage.UrlStorageOptions;
opts = {
url: 'mongodb://address'
};All the other configurations are optional.