This commit is contained in:
Nadar
2026-03-17 13:24:22 +03:00
commit 82e5ac9d81
554 changed files with 29637 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
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)
}