INNER CODE UNIT · TypeScript
getTarGzFileContents
tim-koehler/Helm-Intellisense · src/utils.ts:264
function getTarGzFileContents(filePath: string): Promise<Map<string, string>> {
const extract = tarStream.extract();
const fileStream = fs.createReadStream(filePath);
const gunzip = zlib.createGunzip();
const fileContent = new Map<string, string>();
extract.on('entry', (header, stream, next) => {
if (header.name.endsWith('.tpl') || header.name.endsWith('.yaml') || header.name.endsWith('.yml')) {
let data = '';
stream.on('data', chunk => data += chunk.toString());
stream.on('end', () => {
fileContent.set(header.name, data);
next();
});
stream.resume();
} else {
stream.resume();
next();