Created
June 7, 2022 23:44
-
-
Save jfoshee/07f5575989651005243f5541518b470a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadBlob(blob: Blob, filename: string): void { | |
const downloadLink = document.createElement('a'); | |
document.body.appendChild(downloadLink); | |
downloadLink.style.setProperty('display', 'none'); | |
const objectUrl = URL.createObjectURL(blob); | |
downloadLink.href = objectUrl; | |
downloadLink.download = filename; | |
downloadLink.click(); | |
URL.revokeObjectURL(objectUrl); | |
downloadLink.remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment