diskStorage() not found in nestJs multer file upload

Viewed 2978

i want use multer in my nestJs application like this:

@Post()
@UseInterceptors(
    FileInterceptor('file', {
        storage: diskStorage({
            destination: './files',
        }),
    }),
)
async upload(@Request() req, @Query() query: any, @UploadedFile() file) {
    console.log(file);
}

But my IDE (vscode) keeps saying: Cannot find name 'diskStorage' and is not compiling. I also register the MulterModule on the specified Module (FeatureModule).

I can use

@UseInterceptors(
    FileInterceptor('file', { dest: '/data-path'}),
)

But i want change the filename for example. For this I need the diskStorage function

What can i do, to resolve the issue?

1 Answers
Related