Untitled

 avatar
unknown
plain_text
3 years ago
515 B
4
Indexable
function downloadURL(data, fileName) {
    const a = document.createElement('a')
    a.href = data
    a.download = fileName
    document.body.appendChild(a)
    a.style.display = 'none'
    a.click()
    a.remove()
}

function DownloadBlob(data: Uint8Array, fileName: string, mimeType: string) {

    const blob = new Blob([data.buffer], {
        type: mimeType
    })

    const url = window.URL.createObjectURL(blob)

    downloadURL(url, fileName)

    setTimeout(() => window.URL.revokeObjectURL(url), 1000)
}
Editor is loading...