diff --git a/src/lib/client/downloader.ts b/src/lib/client/downloader.ts deleted file mode 100644 index c75c651..0000000 --- a/src/lib/client/downloader.ts +++ /dev/null @@ -1,21 +0,0 @@ -const createAnchorElement = (url: string, filename: string): HTMLAnchorElement => { - const anchor = document.createElement('a'); - anchor.href = url; - anchor.download = filename; - return anchor; -}; -export const download = async (url: string, filename: string) => { - const response = await fetch(url); - - if (!response.ok) { - throw new Error('Network response was not ok'); - } - - const blob = await response.blob(); - const objectURL = window.URL.createObjectURL(blob); - const anchor = createAnchorElement(url, filename); - document.body.appendChild(anchor); - anchor.click(); - anchor.remove(); - window.URL.revokeObjectURL(objectURL); -}; diff --git a/src/lib/components/DownloadManager.svelte b/src/lib/components/DownloadManager.svelte index efe3bc0..ffa1444 100644 --- a/src/lib/components/DownloadManager.svelte +++ b/src/lib/components/DownloadManager.svelte @@ -1,73 +1,22 @@ -{#if visible} +
- Downloading {filename} -
-{progress}%
++ Downloading {filename} +
+{progress}%