vue json 里的文件解码

2023-06-23  本文已影响0人  草小孟
const decodeContent = atob(fileResponse.fileContent);/// 需要手动解码
const uint8Array = new Uint8Array(decodeContent.length);for (let i = ; i < decodeContent.length; i++) [uint8Array[i] = decodeContent.charCodeAt(i);
const blob = new Blob([uint8Array]);const filename = fileResponse.filename;const link = document .createElement('a');link.href = URL.createObjectURL(blob);link.download = filename;link.click();
上一篇下一篇

猜你喜欢

热点阅读