Thought I had this fixed but it stopped working again
const stream=async(url,data,mimeType,method="POST")=>{
return new Promise((resolve,reject)=>{
let oReq = new XMLHttpRequest();
oReq.open(method, url, true);
oReq.responseType = "arraybuffer";
oReq.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
oReq.onload = function() {
let arrayBuffer = oReq.response;
resolve(new Blob([arrayBuffer], {type: mimeType}));
}
oReq.onerror = function (e) {
reject(e);
}
oReq.send(JSON.stringify(data));
});
}
worked a few times returning a Blob when I call
let blob=await stream("http://ipfs.localhost:8080/ipfs/QmdtLCqzYNJdhJ545PxE247o6AxDmrx3YT9L5XXyddPR1M",undefined,"image/png","GET");
but now it just throws an error. Any suggestions? The file requested is pinned and shows correctly with the URL in the browser.