diff --git a/src/lib/client/downloader.ts b/src/lib/client/downloader.ts index cb2d821..c75c651 100644 --- a/src/lib/client/downloader.ts +++ b/src/lib/client/downloader.ts @@ -1,21 +1,21 @@ const createAnchorElement = (url: string, filename: string): HTMLAnchorElement => { - const anchor = document.createElement('a'); - anchor.href = url; - anchor.download = filename; - return anchor -} + 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); + const response = await fetch(url); - if (!response.ok) { - throw new Error('Network response was not ok'); - } + 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); -} + 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 761f47f..efe3bc0 100644 --- a/src/lib/components/DownloadManager.svelte +++ b/src/lib/components/DownloadManager.svelte @@ -52,12 +52,16 @@ {#if visible} -
- Downloading {filename} + Downloading {filename}
-