Created
December 5, 2012 15:35
-
-
Save exinferis/4216618 to your computer and use it in GitHub Desktop.
Convert Data URI to JS blob
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
dataURItoBlob: (dataURI) => | |
binary = atob(dataURI.split(",")[1]) | |
array = [] | |
i = 0 | |
while i < binary.length | |
array.push binary.charCodeAt(i) | |
i++ | |
return new Blob( [new Uint8Array(array)], | |
type: "image/jpeg" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment