Created
October 29, 2020 09:31
-
-
Save Gummiees/2d6898dbbea461dac0fbe2a95424f4eb to your computer and use it in GitHub Desktop.
Download Blob in TS
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
public downloadBlob(blob: Blob, documentName: string, extension: string) | |
{ | |
const fileURL = URL.createObjectURL(blob); | |
const a: HTMLAnchorElement = document.createElement('a'); | |
document.body.appendChild(a); | |
a.href = fileURL; | |
a.download = `${documentName}.${extension}`; | |
a.click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment