I am trying to get a file from azure blob and sedn the file to nextjs frontend. However, my response comes as a string.
this is my controller function
@Get('download/:id')
async getDownloadedFile(@Request() req: JwtRequest, @Param('id') id: string, @Res() res: Response){
const blobName = `/chain/${id}`.toLowerCase();
const container = req.authContext.id.toLowerCase();
const downloadResponse = await this.azureStorageService.getFile(container, blobName)
res.setHeader('Content-Disposition', `attachment; filename="file.txt"`);
res.setHeader('Content-Type', 'application/octet-stream');
downloadResponse.pipe(res);
}
however on the frontend, the Content-Type is still application-json and the response comes as a string.