Skip to content

Instantly share code, notes, and snippets.

@steel1990
Created October 1, 2014 03:12
Show Gist options
  • Save steel1990/e6fb249cc7132355d121 to your computer and use it in GitHub Desktop.
Save steel1990/e6fb249cc7132355d121 to your computer and use it in GitHub Desktop.
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