I've been struggling to reveal a .zip file in my VueJS application that contains multiple files stored on a remote server. So far, my attempts have only been successful with a single .csv file; the download works fine, but when I try to open the archive, it's considered invalid.
In an effort to solve this issue, I followed the guidance provided in this previous thread:
try {
const response = await axios.get(download_url, {
responseType:'blob'
});
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "filename.zip");
document.body.appendChild(link);
link.click();
} catch (error) {
console.log(error);
}
Although this method allows me to download the .zip file, it's still seen as invalid and cannot be opened. My ultimate goal is to repeat this process with multiple "download_urls" to create a .zip file with multiple files, but for now, I just need to make it work with one file!
Thank you in advance for any assistance you can provide.