Spaces:
Running
Running
File size: 469 Bytes
f23825d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
function download(url: string, name = "noname") {
const a = document.createElement("a")
a.href = url
a.download = name
a.style.display = "none"
document.body.appendChild(a)
a.click()
a.remove()
}
// http://stackoverflow.com/a/33622881/1567777
export function downloadBlob(blob: Blob, fileName: string) {
const url = window.URL.createObjectURL(blob)
download(url, fileName)
setTimeout(() => {
return window.URL.revokeObjectURL(url)
}, 1000)
}
|