I am making https get a request to get the image and trying to show that image into the desktop app, but I am getting a weird binary response of the image, like diamonds, symbols etc. But I am unable to convert that to base64, but if I give absolute path of the image into the image src tag then it renders fine, but this has an issue with the server authentication process, so I need to make https call and show the image. I have attached the response of the image, can anyone help me how to decode this string and show the image in JavaScript?
Code to decode: angular ajax, response type is set as "binary"
const length = response.length;
const array = new Uint8Array(length);
for (let i = 0; i < length; i++){
array[i] = response.charCodeAt(i);
}
const u8 = new Uint8Array(array);
const b64encoded = btoa(String.fromCharCode.apply(null, u8));