export function getStreamFile(res, fileName) {
const { data } = res;
console.log(data);
const blob = new Blob([data]);
let elink = document.createElement("a");
elink.download = fileName || "filename";
elink.style.display = "none";
let href = window.URL.createObjectURL(blob);
elink.href = href;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
window.URL.revokeObjectURL(href); // 释放掉blob对象
}
网友评论