4

I am using blob to view a file(no specific type) in a new tab. If the file preview is supported, the file is view-able. However, if it is not supported the file gets downloaded. is it possible to stop it from downloading or download using a custom file name instead of random name generated using createObjectURL?

download(image: Blob) {
const url = window.URL.createObjectURL(image);
window.open(url);
}



this.http.post<Blob>(**APILink**, data, { headers: {token details}, responseType: 'blob' as 'json' }).subscribe((response) => {
  this.download(response);
}
Aarji George
  • 599
  • 4
  • 8

0 Answers0