Skip to content

Instantly share code, notes, and snippets.

@lili21
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lili21/d8a399cdf454e0dce186 to your computer and use it in GitHub Desktop.
Save lili21/d8a399cdf454e0dce186 to your computer and use it in GitHub Desktop.
base64 to blob (more readable)
function b2b(base64) {
var decode, i, length, byteArray;
i = 0;
decode = atob(base64);
length = decode.length;
byteArray = new Uint8Array(length);
for (;i < length;i++) {
byteArray[i] = decode.charCodeAt(i);
}
return new Blob([byteArray]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment