2 文件目录为
一个zip文件中,有一个zip包和一个json文件,要做的就是读取info.json中文件内容
3 具体代码:var AdmZip = require('adm-zip');
var zip = new AdmZip(__dirname+"/result.zip");
var zipEntries = zip.getEntries();
zipEntries.forEach(function(zipEntry) {
if (zipEntry.isDirectory == false) {
console.log("pop============"+zipEntry.entryName.toString().split("/").pop() );
if((zipEntry.entryName.toString().split("/").pop() )==("info.json") ){
// console.log("------------111="+zipEntry.toString());
console.log("------------="+zip.readAsText("result/info.json"));
}
}
});
记得要提前使用npm install adm-zip
查看结果:
pop============nexus5_sh.zip
pop============info.json
------------={"device","nexus","5.0"},
{"case1","pass"}