Created
January 26, 2017 18:22
-
-
Save tgcnzn/360265b196c8b5dd7ef7be92e99c9323 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function base64ToBlob(data) { | |
var byteString = atob(data.split(',')[1]); | |
var mimeString = data.split(',')[0].split(':')[1].split(';')[0] | |
var ab = new ArrayBuffer(byteString.length); | |
var ia = new Uint8Array(ab); | |
for (var i = 0; i < byteString.length; i++) { | |
ia[i] = byteString.charCodeAt(i); | |
} | |
var blob = new Blob([ab]); | |
return blob; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment