Reputation: 255
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. After saving zip file. If I try to open the file, it says invalid zip error.
Upvotes: 13
Views: 19718
Reputation: 2501
You can try adding responseType as arraybuffer
axios.get(
fileUrl,
{headers:{'X-API-TOKEN':xxxxx}, responseType: 'arraybuffer'}
);
Upvotes: 42