<script>
function download(fileUrl,fileName) {
fetch(fileUrl).then(res => res.blob()).then(blob => {
const a = document.createElement('a')
document.body.appendChild(a)
a.style.display = 'none'
const url = window.URL.createObjectURL(blob)
a.href = url
a.download = fileName
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
})
}
</script>
文件链接转成文件流
最新推荐文章于 2024-02-19 17:51:16 发布