This commit is contained in:
Maciej Caderek
2022-02-12 18:52:25 +01:00
parent f4b0d337ac
commit 840545886d
9 changed files with 159 additions and 21 deletions

10
src/utils/download.ts Normal file
View File

@@ -0,0 +1,10 @@
const download = (data: string | Blob, name: string, ext: string) => {
const url = typeof data === "string" ? data : URL.createObjectURL(data);
const link = document.createElement("a");
link.href = url;
link.download = `${name}_${Date.now()}.${ext}`;
link.click();
};
export default download;