Created
March 31, 2021 14:53
-
-
Save Yannick243/bbc2767f250ae98c031caf39a25fb1df to your computer and use it in GitHub Desktop.
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
export const b64toBlob = (dataURI) => { | |
const byteString = atob(dataURI.split(',')[1]) | |
const ab = new ArrayBuffer(byteString.length) | |
const ia = new Uint8Array(ab) | |
for (let i = 0; i < byteString.length; i++) { | |
ia[i] = byteString.charCodeAt(i) | |
} | |
return new Blob([ab], { type: 'image/jpeg' }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment