将文件链接地址转为blob

fetch('https://blog.csdn.net').then(res => res.blob()).then(blob => { 
  const a = document.createElement('a')
  a.href = URL.createObjectURL(blob)
  console.log(a.href)
  a.download = ''  // 下载文件的名字
  document.body.appendChild(a)
  a.click()})

标签: none

阅读量:459