运行到解析zip时报错:
let path: string = url.raw('resources/anims.zip');
loader.load({ url: path, type: "binary", }, (err, res) => {
if (err) return;
console.log(res)
console.log('读取到文件?');
JSZip.loadAsync(res).then((zip: JSZip) => { //这里报错,下面的输出都没显示
console.log('-----------------');
console.log(zip.files);
let path:string="boom3.png";
console.log('读取到文件');
zip.file("path").async("base64").then((data: string) => {
// console.log(JSON.parse(data));
console.log(data);
})
})
});
报错信息:
Uncaught (in promise) Error: Can’t find end of central directory : is this a zip file ? If it is, see
https://stuk.github.io/jszip/documentation/howto/read_zip.html
at ZipEntries.readEndOfCentral (jszip.js:4102)
at ZipEntries.load (jszip.js:4194)
at jszip.js:1216