mirror of https://github.com/abpframework/abp.git
committed by
GitHub
2 changed files with 21 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
export function downloadBlob(blob: Blob, filename: string) { |
||||
|
const blobUrl = URL.createObjectURL(blob); |
||||
|
|
||||
|
const link = document.createElement('a'); |
||||
|
|
||||
|
link.href = blobUrl; |
||||
|
link.download = filename; |
||||
|
|
||||
|
document.body.appendChild(link); |
||||
|
|
||||
|
link.dispatchEvent( |
||||
|
new MouseEvent('click', { |
||||
|
bubbles: true, |
||||
|
cancelable: true, |
||||
|
view: window, |
||||
|
}), |
||||
|
); |
||||
|
|
||||
|
document.body.removeChild(link); |
||||
|
} |
||||
Loading…
Reference in new issue