0

I have a strange responde from an external API

ok:true
status:200
statusText:"OK"
type:2
_body:"�PNG↵↵IHDR�X:�(��IDATx��6��g��L&��s�I4�ƅ�G\QTQ#���Ib�Ep�w# (�

The body responde is an PNG. when the API URL is open on a tab the image is well displayed.

The question is: How can I make this image to a File, Blob or something in Typescript to download it. Or how using that response make the image download in typescript.

Jorge Monroy
  • 408
  • 1
  • 5
  • 16
  • Might be a base64 encoded image. What API is it and how are you accessing it – Chad K Aug 21 '18 at 22:50
  • 2
    This is a PNG binary being received as a string. Set the [responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType) to blob.. – georgeawg Aug 22 '18 at 00:36
  • Possible duplicate of [Getting Image from API in Angular 4?](https://stackoverflow.com/questions/45530752/getting-image-from-api-in-angular-4) – georgeawg Aug 22 '18 at 00:39

0 Answers0