INNER CODE UNIT · JavaScript

listTarGzEntries

agent-sh/agentsys · lib/binary/index.js:323

function listTarGzEntries(buf) {
  return new Promise(function(resolve, reject) {
    const tar = cp.spawn('tar', ['-tz'], { stdio: ['pipe', 'pipe', 'pipe'] });
    let stdout = '';
    let stderr = '';
    tar.stdout.on('data', function(d) { stdout += d; });
    tar.stderr.on('data', function(d) { stderr += d; });
    tar.on('error', reject);
    tar.on('close', function(code) {
      if (code !== 0) {
        reject(new Error('tar -tz listing failed (code ' + code + '): ' + stderr));
        return;
      }
      const entries = stdout.split(/\r?\n/).filter(function(l) { return l.length > 0; });
      resolve(entries);
    });
    tar.stdin.write(buf);
    tar.stdin.end();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…