Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Created February 14, 2016 21:26
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 zzarcon/6aa7ea98da281b9f1ce5 to your computer and use it in GitHub Desktop.
Save zzarcon/6aa7ea98da281b9f1ce5 to your computer and use it in GitHub Desktop.
function fetchBlob(uri, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', uri, true);
xhr.setRequestHeader("X-Mashape-Key", config.mashapeKey);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
if (this.status == 200) {
var blob = this.response;
if (callback) {
callback(blob);
}
}
};
xhr.send();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment