Created
September 24, 2019 15:28
-
-
Save examinedliving/07511776f6c9ae8ce65e7a88d3f3d226 to your computer and use it in GitHub Desktop.
Base64 to Blob (es6)
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 b64toBlob = async (b64Data, contentType = 'application/octet-stream') => { | |
| const url = `data:${contentType};base64,${b64Data}`; | |
| const response = await fetch(url); | |
| const blob = await response.blob(); | |
| return blob; | |
| }; | |
| // https://stackoverflow.com/a/36183085/1167442 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment