Beispiel #1
0
 res.on('end', function(){
     write.end();
     tarball.extractTarball(
         targzPath, dest,
         function(err){
             if (err){
                 dialog.showErrorBox('更新失败', '删除文件出错');
                 app.quit();
             }else{
                 fse.copySync(sourcePath, destPath, {clobber: true});
                 fse.removeSync(targzPath);
                 fse.removeSync(sourcePath);
                 events.emit('hide progress');
                 dialog.showMessageBox(
                     {
                         type: 'question',
                         buttons: ['是'],
                         message: '请重新打开应用程序',
                         title: '更新完成',
                         noLink: false
                     }, function(res){
                         events.emit('destroy progress');
                     });
             }
         });
 });
Beispiel #2
0
module.exports.extract = function(tgzPath, callback) {
	var tarball = require('tarball-extract')
	tarball.extractTarball(tgzPath, path.dirname(tgzPath), function(err){
		if(err) console.log(err)
		callback(err)
	});
}
Beispiel #3
0
 return new Promise((resolve, reject) => {
   tarball.extractTarball(filePath, destPath, (err) => {
     if (err) {
       return reject(err);
     }
     resolve();
   });
 });
Beispiel #4
0
	}).pipe(fs.createWriteStream(ttagstemp)).on("finish", function () {
		fs.renameSync(ttagstemp,ttags);console.log("Tatoeba audio ids downloaded");
		var Bunzip = require('seek-bzip');
		var compressedData = fs.readFileSync(ttags);
		var data = Bunzip.decode(compressedData);
		fs.writeFileSync(ttagstemp, data);
		var tarball = require('tarball-extract');
		tarball.extractTarball(ttagstemp, ttagsbakfu, function(err){
		if(err) console.log(err);
		});
		//download something else now:
	});
Beispiel #5
0
	}).pipe(fs.createWriteStream(tlinktemp)).on("finish", function () {
		fs.renameSync(tlinktemp,tlink);console.log("Tatoeba links downloaded");
		var Bunzip = require('seek-bzip');
		var compressedData = fs.readFileSync(tlink);
		var data = Bunzip.decode(compressedData);
		fs.writeFileSync(tlinktemp, data);
		var tarball = require('tarball-extract');
		tarball.extractTarball(tlinktemp, tlinkbakfu, function(err){
		if(err) console.log(err);
		});
		download_tags();
	});
Beispiel #6
0
 .on('close', function () {
   tarball.extractTarball(pkg, __dirname, function (err, result) {
     if (err) {
       throw err
     }
     fs.unlink(pkg, function (err) {
       if (err) {
         throw err
       }
     })
   })
 })
Beispiel #7
0
 return new Promise((resolve, reject) => {
   const tmpDirPath = temp.mkdirSync();
   tarball.extractTarball(archivePath, tmpDirPath, (err) => {
     if (err) {
       let title = 'PlaftormIO: Failed to extract virtualenv.';
       atom.notifications.addError(title, {detail: err, dismissable: true});
       console.error(title);
       console.error('' + err);
       reject();
     }
     resolve(tmpDirPath);
   });
 });
Beispiel #8
0
 return new Promise((resolve, reject) => {
   const tmpDirPath = temp.mkdirSync({prefix: 'virtualenv-'});
   tarball.extractTarball(state.virtualenvArchivePath, tmpDirPath, (err) => {
     if (err) {
       let title = 'PlaftormIO: Failed to extract virtualenv.';
       atom.notifications.addError(title, {detail: err, dismissable: true});
       console.error(title);
       console.error('' + err);
       reject(state);
     }
     state.virtualenvExtractedInto = tmpDirPath;
     resolve(state);
   });
 });
Beispiel #9
0
function processAppTarball(tarPath, appsRootDir, onProgress, onDone) {
  /** make sure appsRootDir is an absolute path */
  extractor.extractTarball(tarPath, appsRootDir, function (err) {
    if (err) { 
      console.log(err)
      onDone(err);
    } else {
      console.log('success');
      var appName = _.last(tarPath.split('/')).split('.')[0]
      var appOutDir = appsRootDir + appName + '/';
      console.log(appOutDir);
      readDir.read(appOutDir, [ '**.apk' ], function (err, files) {
        if (err) {
          console.log(err);
          onDone(err);
        } else {
          var apkPath = appOutDir + files[0];
          console.log(apkPath);
          processApp(apkPath, onProgress, onDone);
        }
      })
    }
  })
}