I have downloaded some basic image somewhere from google:
then I use this httprequest to read and save raw data of the image:
var xhr = new XMLHttpRequest;
xhr.open("GET", pInput, false);
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
return xhr.responseText;
}
};
and it looks it works fine but its only somehow reformatted:

any idea how to at least find out which format it is returns from XMLHttpRequest so I can try to reformate it back?
NOTE: I use the solution to read raw data of the image to be able to send it via next httprequest to CDN server via their API. I have found out the Image after upload can not be viewed, so I have identified the problem of the first httprequest above that the encoding is different from input file... basicaly when I save this initial httprequest as .jpg file, it can not be displayed as no software know this format

