let oReq = new XMLHttpRequest()
oReq.open('GET', file.url, true)
oReq.responseType = 'blob'
oReq.onload = function () {
let content = oReq.response
let elink = document.createElement('a')
elink.download = file.name
elink.style.display = 'none'
let blob = new Blob([content])
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
document.body.removeChild(elink)
}
oReq.send()
Download the file to the current browser
Guess you like
Origin blog.csdn.net/u014165391/article/details/124983138
Recommended
Ranking