function download (href, name) {
const xhr = new XMLHttpRequest()
xhr.open('GET', href, true)
xhr.responseType = 'blob'
xhr.onload = () => {
if (xhr.status === 200) {
saveAs(xhr.response, name)
}
}
xhr.send()
};
function saveAs(data, name) {
const urlObject = window.URL || window.webkitURL || window;
const export_blob = new Blob([data]);
const save_link = document.createElement('a')
save_link.style.display = 'none';
save_link.href = urlObject.createObjectURL(export_blob);
save_link.download = name;
document.body.appendChild(save_link);
save_link.click();
document.body.removeChild(save_link);
}