WIP
This commit is contained in:
10
src/utils/download.ts
Normal file
10
src/utils/download.ts
Normal 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;
|
||||
Reference in New Issue
Block a user