After I launch my function, why does the console throw this error:
ReferenceError: Response is not defined
Here's my code snippet:
@Get('/download/:fileId')
@Header('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
async downloadFile(
@Param('fileId') id: number,
@Res() response: Response
) {
const fileName= await this.reportService.getFileName(id);
response.headers.set('Content-Type',`attachment; filename=${fileName}`);
return await this.fileService.downloadFile(id);
}
The purpose of this function is to download a file from a local folder in my NestJS project.
Thank you for any assistance.