【发布时间】:2020-05-09 18:57:14
【问题描述】:
不知道JSZip库的用途,有的话可以问我问的问题。
我的想法是这样的:
generateZip() {
const a = ['arraybase64example'];
const zip = new JSZip();
Array.from(a)
.forEach(file => {
zip.file("prueba", file)
})
return zip.generateAsync({
type: 'arraybuffer', // changed from blob to arrayBuffer
compression: 'DEFLATE',
compressionOptions: {
level: 9
}
}).then(function (content) {
window.location.href = content; // Type 'ArrayBuffer' cannot be assigned to type 'string'
});
}
我无法从浏览器下载与全局窗口对象相关的 .zip 文件。
【问题讨论】:
-
您面临的问题是什么?
标签: javascript angular zip