How to use the tar.gz2 function in tar

To help you get started, we’ve selected a few tar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JaneaSystems / nodejs-mobile-cordova / install / hooks / ios / before-plugin-install.js View on Github external
return new Promise((resolve, reject) => {
      // Unzip and untar the libnode.Framework
    if (fs.existsSync(zipFilePath)) {
        targz2().extract(zipFilePath, nodeMobileFolderPath, function(err) {
        if (err) {
            reject(err);
        } else {
            fs.unlinkSync(zipFilePath);
            resolve();
        }
        });
    } else if (!fs.existsSync(nodeMobileFilePath)) {
        reject(new Error(nodeMobileFileName + ' is missing'));
    } else {
        resolve();
    }
  });
}
github Azure / autorest / src / bootstrapper / installer / index.ts View on Github external
return new Promise((resolve, reject)=>{
      console.log(`Downloading ${runtime.browser_download_url} to ${this.framework}`);
      let download = request.get(runtime.browser_download_url,{strictSSL:true,headers:{'user-agent':'autorest-installer',"Authorization": `token ${Utility.Id}`}});
      let unpack:any = null;

      if( runtime.name.endsWith('.zip' )) {
        unpack = download.pipe(unzip.Extract({ path: this.framework }))
      }
      else {
        unpack = download.pipe( tgz().createWriteStream(this.framework) )
      }
      unpack.on('close', resolve );
      unpack.on('error', reject );
      });
  }
github Azure / autorest / src / autorest / installer.ts View on Github external
private static HttpGet(url: string, filename: string, targetFolder: string, resolve, reject) {
    let download = request.get(url, {
      strictSSL: true,
      headers: {
        'user-agent': 'autorest-installer',
        "Authorization": `token ${Utility.Id}`
      }
    });

    let unpack: any = null;
    if (filename.endsWith('.zip')) {
      unpack = download.pipe(unzip.Extract({ path: targetFolder }))
    }
    else {
      unpack = download.pipe(tgz().createWriteStream(targetFolder))
    }

    unpack.on('error', () => {
      let newUrl = this.GetFallbackUrl(url);
      if (newUrl == null) {
        Console.Error(`Failed to download file: ${filename}`);
        return reject();
      }
      Console.Error(`Failed to download file: ${filename}, trying fallback url.`);
      this.HttpGet(newUrl, filename, targetFolder, resolve, reject);
    });

    unpack.on('finish', () => {
      setTimeout(resolve, 500);
    });