I have a binary zip file as response from an api call. I want to download the zip file directly using Javascript/React. How can I achieve this goal?
Read this FileReader and try this function:
function readFile(binaryFile) { let reader = new FileReader(); reader.readAsArrayBuffer(binaryFile); // in success case, do something with result reader.onload = function() { console.log(reader.result); }; // in error case, do something with result reader.onerror = function() { console.log(reader.error); }; }
with best regards!