Added download blob function
This commit is contained in:
parent
f3049160b6
commit
7063b80bdd
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.13.2",
|
"version": "0.13.3",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -6,3 +6,9 @@ export function download(href: any, name: string) {
|
|||||||
a.click();
|
a.click();
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function downloadBlob(blob: Blob, name: string) {
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
download(url, name);
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user