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; } } }); }
writeFilePromises.push(outputFile(target, zipEntry.getData()));