Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

download blob typescript

public downloadBlob(fileName: string, blob: Blob): void {
  if (window.navigator.msSaveOrOpenBlob) {
    window.navigator.msSaveBlob(blob, fileName);
  } else {
    const anchor = window.document.createElement('a');
    anchor.href = window.URL.createObjectURL(blob);
    anchor.download = fileName;
    document.body.appendChild(anchor);
    anchor.click();
    document.body.removeChild(anchor);
    window.URL.revokeObjectURL(anchor.href);
  }
}
Source by blog.digital-craftsman.de #
 
PREVIOUS NEXT
Tagged: #download #blob #typescript
ADD COMMENT
Topic
Name
9+6 =