@apistudio/apim-cli
Version:
CLI for API Management Products
28 lines • 1.02 kB
JavaScript
import JSZip from 'jszip';
export class ZipProcessor {
async extractGatewaysJson(buffer) {
//.logDebug('0003', 'Extracting gateways.json from ZIP');
const zip = new JSZip();
let gatewaysJsonContent = {};
try {
const zipContent = await zip.loadAsync(buffer);
for (const fileName in zipContent.files) {
const entry = zipContent.files[fileName];
if (entry && !entry.dir && fileName.includes('gateways.json')) {
try {
const content = await entry.async('string');
gatewaysJsonContent = JSON.parse(content);
}
catch {
//.logError('0013', 'parsing gateways.json', `${err}`);
}
}
}
}
catch {
//.logError('0013', 'loading ZIP', `${err}`);
}
return gatewaysJsonContent;
}
}
//# sourceMappingURL=build-asset.js.map