Created
January 26, 2022 17:06
-
-
Save istudyatuni/f7d70e4dc8880c37df60d4a031e87e5e to your computer and use it in GitHub Desktop.
Download blob as file
This file contains hidden or 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
const response = await fetch('/url') | |
const blob = await response.blob() | |
const a = document.createElement('a') | |
a.setAttribute('download', 'your-file.extension') | |
a.href = URL.createObjectURL(blob) | |
a.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment