axios({
method: 'get',
url: url,
responseType: "blob"
}).then(response => {
if(response.data.type === "application/octet-stream") {
const filename = response.headers["content-disposition"];
// let blob = new Blob([response.data], {type: 'text/json'});
const blob = new Blob([response.data]);
const downloadElement = document.createElement("a");
const href = window.URL.createObjectURL(blob);
downloadElement.href = href;
downloadElement.download = filename.split("filename=")[1];
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(href);
}
}).catch(function (error) {
console.log(error);
});