Util.extractTarball = function()

in pipeline/local_modules/pipeline_utils/pipeline_utils.js [140:160]


Util.extractTarball = function (sourcePath, destDirectory) {
  return new Promise(function (resolve, reject) {
    console.log("Extracting tarball '" + sourcePath + "' to '" + destDirectory + "'");

    var sourceFile = fs.createReadStream(sourcePath)
      .on('error', reject);

    var gunzip = zlib.createGunzip()
      .on('error', reject);

    var extractor = tar.Extract({
      path: destDirectory
    })
      .on('error', reject)
      .on('end', resolve);

    sourceFile
      .pipe(gunzip)
      .pipe(extractor);
  });
}