export const useDownload = (url: string, filename: string) => { const download = () => { fetch(url) .then((response) => response.blob()) .then((blob) => { const url = window.URL.createObjectURL(new Blob([blob])) const link = document.createElement('a') link.href = url link.setAttribute('download', filename) document.body.appendChild(link) link.click() link.parentNode?.removeChild(link) }) } return { download } }