[英]Unable to download zip file using axios
This is the code I use: 这是我使用的代码:
axios.get(fileUrl, {headers:{'X-API-TOKEN':xxxxxx})
Response data received is in binary, Which I am converting to base64 and saving in file. 收到的响应数据是二进制的,我将转换为base64并保存在文件中。 After saving zip file. 保存zip文件后。 If I try to open the file, it says invalid zip error. 如果我尝试打开该文件,则表示无效的zip错误。
You can try adding responseType as arraybuffer 您可以尝试将responseType添加为arraybuffer
axios.get(
fileUrl,
{headers:{'X-API-TOKEN':xxxxx}, responseType: 'arraybuffer'}
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.