So in fetch i am using this
const response = await fetch(
`download`,
)
.then((response) => response.blob())
.then((res) => {
console.log(res);
const downloadLink = document.createElement("a");
downloadLink.href = URL.createObjectURL(res);
downloadLink.download = "test.zip";
// Programmatically trigger the download
downloadLink.click();
});
At this it works perfectly but when i use this code for axios the file not open
await axios
.get("download", {
responseType: "blob",
})
.then(async (response) => {
const blob = new Blob([response.data]);
const downloadLink = document.createElement("a");
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = "test.zip";
// Programmatically trigger the download
downloadLink.click();
});
// });```
I have tried to use another more options but it didnt work