1,jszip 是一个用于创建、读取和编辑.zip文件的JavaScript库,且API的使用也很简单。
首先,先引入第三方库jszip,具体看 Egret 引入第三方库_caiqishi的博客-CSDN博客
读取zip文件:
class JszipDemo {
constructor() {
this.init();
}
//把config.zip添加进defaunlt.res.json,以便读取
public init() {
let comment = '';
RES.getResAsync("config_zip", (data, key) => {
JSZip.loadAsync(data, null).then((zipData) => {
zipData.file("config_4.json").async("text").then((text) => {
comment = JSON.parse(text);
console.log(comment);
});
});
}, this);
}
}