export default (filename: string, content: string | File | Blob) => { let blob: File | Blob if (typeof content === 'string') { blob = new File([content], filename, { type: 'text/plain', }) } else { blob = content } const url = window.URL.createObjectURL(blob) const link = document.createElement('a') link.href = url link.setAttribute( 'download', filename, ) document.body.appendChild(link) link.click() window.URL.revokeObjectURL(url) document.body.removeChild(link) }