I have an image that was readed to javascript.
I used sublime text to see the image and it is like this:
I readed this image and generate javscript arrayBuffer of Uint8Array
Inside this arrayBuffer, i see also ffd8 ffe0 like in photo above.
Now, i need to downlaod it to local machine, i used
var blob1 = new Blob([byteArray], {type: 'application/octet-stream'});
var fileName1 = "cool.bin";
function saveAs(blob, fileName) {
var url = window.URL.createObjectURL(blob);
var anchorElem = document.createElement("a");
anchorElem.href = url;
anchorElem.download = fileName;
anchorElem.style = 'display: none';
document.body.appendChild(anchorElem);
anchorElem.click();
document.body.removeChild(anchorElem);
// On Edge, revokeObjectURL should be called only after
// a.click() has completed, atleast on EdgeHTML 15.15048
setTimeout(function() {
window.URL.revokeObjectURL(url);
}, 1000);
}
After i downlaoded this image from javascript,
I see in sublime text diffrent bytes
What worng with my javascript donwload code ?