JSFiddle - React, Tailwind, and code Playground
JavaScript
var xhr = new XMLHttpRequest();
xhr.open("GET", "/favicon.png");
//although we can get the remote data directly into an arraybuffer using the string "arraybuffer" assigned to responseType property. For the sake of example we are putting it into a blob and then copying the blob data into an arraybuffer.
xhr.responseType = "blob";
function analyze_data(blob)
{
var myReader = new FileReader();
myReader.readAsArrayBuffer(blob)
myReader.addEventListener("loadend", function(e)
{
var buffer = e.srcElement.result;//arraybuffer object
});
}
xhr.onload = function()
{
analyze_data(xhr.response);
}
xhr.send();