return; var entryName = entry.entryName; var filename = entryName.substring(4); var dashIndex = filename.lastIndexOf('_');
function inferAssetNameFromZip(conn, source, cb) { // temporarily unzip the file and then scan the dir var toplevelXmlRe = new RegExp('^apiproxy/[^/]+\\.xml$'); var zip = new AdmZip(source); var zipEntries = zip.getEntries(); var foundit = false; zipEntries.forEach(function(entry){ if ( ! foundit) { if (toplevelXmlRe.test(entry.entryName)) { let data = entry.getData(); doParseForName(conn, data.toString('utf8'), cb); foundit = true; } } }); }
function needNpmInstall(collection, zipArchive) { if (collection != 'apis') { return false; } var foundPackage = false; var foundNodeModules = false; var zip = new AdmZip(zipArchive); var zipEntries = zip.getEntries(); zipEntries.forEach(function(entry) { if (entry.entryName == 'apiproxy/resources/node/package.json') { foundPackage = true; } if (entry.entryName == 'apiproxy/resources/node/node_modules.zip') { foundNodeModules = true; } }); return foundPackage && !foundNodeModules; }
function finishRemote(err,result) { configName = configName.split(':').pop(); if (argv.verbose) console.log('Making/cleaning output directories'); mkdirp(path.join(config.outputDir,configName),function(){ rimraf(path.join(config.outputDir,configName)+'/*',function(){ if (argv.zip) { fs.writeFileSync(path.join(config.outputDir,configName,configName+'.zip'),result); } else { const zip = new admzip(result); if (argv.verbose) { console.log('Unzipping...'); const zipEntries = zip.getEntries(); // an array of ZipEntry records zipEntries.forEach(function(zipEntry) { console.log(zipEntry.entryName); }); } zip.extractAllTo(config.outputDir,true); } }); }); }