Created
March 17, 2017 11:15
-
-
Save alextanhongpin/e474981ca046f1f87f33cda6f3562fb0 to your computer and use it in GitHub Desktop.
converts base 64 url to image
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
export default function dataURItoBlob (base64) { | |
const byteString = window.atob(base64) | |
const mimestring = 'image/jpeg' | |
const content = [] | |
for (let i = 0; i < byteString.length; i++) { | |
content[i] = byteString.charCodeAt(i) | |
} | |
return new window.Blob([new Uint8Array(content)], {type: mimestring}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment