js - 流文件


js - 流文件

图片流显示

let imgSrc = window.URL.createObjectURL(new Blob([res]))

流文件下载

    // ie10+
      let blob= new Blob([res]),
      name=row.theme_name+'.jpg'
      if (navigator.msSaveBlob) {
        return navigator.msSaveBlob(blob, name);
      } else {
        var link = window.URL.createObjectURL(blob);
        var a = document.createElement('a');
        a.href = link;
        a.download = name;
        a.click();
      }