diff --git a/lib/DownloadFile.js b/lib/DownloadFile.js index 81422cf..38492c3 100644 --- a/lib/DownloadFile.js +++ b/lib/DownloadFile.js @@ -26,13 +26,21 @@ export default class DownloadFile { } download() { + let blob = this.chunks.toBlob() let url = URL.createObjectURL(blob) + let a = document.createElement('a') + document.body.appendChild(a) a.download = this.name a.href = url a.click() - URL.revokeObjectURL(url) + + setTimeout(() => { + URL.revokeObjectURL(url) + document.body.removeChild(a) + }, 0) + } toJSON() {