Created
October 1, 2014 03:12
-
-
Save steel1990/e6fb249cc7132355d121 to your computer and use it in GitHub Desktop.
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
var base64ToBlobURL = function(base64, cb) { | |
base64 = base64.split(','); | |
var binary = atob(base64[1]); | |
var len = binary.length; | |
var buffer = new ArrayBuffer(len); | |
var view = new Uint8Array(buffer); | |
for (var i = 0; i < len; i++) { | |
view[i] = binary.charCodeAt(i); | |
} | |
var blob = new Blob([view], { type: base64[0].split(':')[1].split(';')[0] }); | |
return URL.createObjectURL(blob); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment