如何将axios抓取的文件流转发return到前端?

How to forward the file stream fetched from axios and return it to the front-end?

如何将axios抓取的文件流return转发到前端?

在 nest 中,我正在使用 axios 从某处获取内容类型:“application/octet-stream”文件流,我可以获取此文件,但如何 return 此文件到前端?

// service
this.httpService.get(`...`, {
      params: {
        ...
      },
      responseType: 'arraybuffer'
});

// controller
async export(@Req() req: any, @Res() res) {
    res.header('Content-disposition', 'attachment; filename=xxx.xlsx');
    res.header('Content-type', 'application/octet-stream');

    const _buffer = await this.Service.export(id);
    return await res.send(_buffer.data);
}