Created
May 12, 2014 09:42
-
-
Save vkurchatkin/bb41418782ada93cdb1a 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
function getImage (url) { | |
var res; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, false); | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = function () { | |
res = btoa(String.fromCharCode.apply(null, new Uint8Array(xhr.response))) | |
}; | |
xhr.send(); | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment