(
@CurrentAuth() auth: AuthContext | null,
@Param(new ZodValidationPipe(FileIdParamSchema)) params: FileIdParamDto,
@Res({ passthrough: true }) res: Response,
)
| 112 | }, |
| 113 | }) |
| 114 | async downloadFile( |
| 115 | @CurrentAuth() auth: AuthContext | null, |
| 116 | @Param(new ZodValidationPipe(FileIdParamSchema)) params: FileIdParamDto, |
| 117 | @Res({ passthrough: true }) res: Response, |
| 118 | ) { |
| 119 | const { buffer, file } = await this.filesService.downloadFile(auth, params.id); |
| 120 | |
| 121 | res.set({ |
| 122 | 'Content-Type': file.mimeType, |
| 123 | 'Content-Disposition': `attachment; filename="${file.fileName}"`, |
| 124 | 'Content-Length': file.size, |
| 125 | }); |
| 126 | |
| 127 | return new StreamableFile(buffer); |
| 128 | } |
| 129 | |
| 130 | @Delete(':id') |
| 131 | @ApiOkResponse({ |
nothing calls this directly
no test coverage detected