示例#1
0
 mkdirp(tmpDir, function (err) {
   if (err) return cb(err)
   extract(zipPath, {dir: tmpDir}, function (err) {
     if (err) return cb(err)
     packager.createApp(opts, tmpDir, cb)
   })
 })
 file.close(function() {
   var appPath = path.join(_config.appsPath,app.id);
   unzip(filePath, { dir: appPath }, function(err) {
     fs.unlink(filePath);
     cb(err);
   });
 })
示例#3
0
nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) {
  if (err) return onerror(err)
  fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform])
  extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) {
    if (err) return onerror(err)
  })
})
示例#4
0
 mkdirp(tmpDir, function(err) {
   if (err) return cb(err);
   extract(zipPath, {dir: tmpDir}, function(err) {
     if (err) return cb(err);
     platformPackager.createApp(opts, tmpDir, cb);
   });
 });
示例#5
0
function unzip(inputPath, outputPath, callback) {
    if (!fs.existsSync(inputPath)) {
        callback({ error: "The file doesn't exist!" });
        return;
    }

    extract(inputPath, { dir: outputPath }, callback);
}
示例#6
0
nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) {
  if (err) return onerror(err)
  fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform])
  fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform]+'"'+paths[platform]+'" '+argv[platform])
  extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) {
    if (err) return onerror(err)
  })
})
示例#7
0
文件: electron.js 项目: BigUps/app
 download({version: version, cache: cachePath}, function (err, zipPath) {
   if (err) return done(err)
   extract(zipPath, {dir: unzipPath}, function (err) {
     if (err) return done(err)
     gutil.log('downloaded!')
     done()
   })
 })
示例#8
0
// unzips and makes path.txt point at the correct executable
function extractFile (zipPath) {
  extract(zipPath, { dir: path.join(__dirname, 'dist') }, function (err) {
    if (err) return onerror(err)
    fs.writeFile(path.join(__dirname, 'path.txt'), platformPath, function (err) {
      if (err) return onerror(err)
    })
  })
}
function unzip(callback) {
  if (!fs.existsSync(config.dirname)) {
    extract(config.filename, { dir: config.dirname }, callback)
  }
  else {
    callback();
  }
}
示例#10
0
文件: app.js 项目: codebear4/AddonBox
 req(file.url, (err, resp, body) => {
     extract(zipFile, {dir: targetDir}, (err) => {
         if(fs.existsSync(zipFile)) {
             fs.unlink(zipFile)
         }
         callback(err)
     })
 }).on('data', (data) => {
示例#11
0
文件: fsutil.js 项目: Sotera/watchman
    return new Promise((res, rej) => {
      // const downloadPath = filePath.replace(/\.(zip$|(tar.){,1}gz$)/i, '');
      const dir = filePath.replace(/\.zip$/i, '');

      extract(filePath, {dir}, err => {
        if (err) return rej(err);
        res(dir);
      });
    });
            .then(function () {

                gutil.log('Unzipping to ', options.private.outputDir);

                extract(options.private.filePath, {
                    dir: options.private.outputDir
                }, cb);

            });
示例#13
0
 r.on('finish', function () {
     extract(k, { dir: iconFolder }, function (err) {
         // extraction is complete. make sure to handle the err 
         if (err) console.log(err);
         vscode.window.showInformationMessage('Icons enabled. Restart the IDE.');
         //remove icon.zip
         fs.unlink(k, function (err) {
             console.log(err);
         });
     });
 });
示例#14
0
    return new Promise(function (resolve, reject) {
        extract(zip.path, {dir: tempPath}, function (err) {
            if (err) {
                debug('Zip extraction error', err);
                return reject(err);
            }

            resolveBaseDir(tempPath, zip).then(function resolveResult(result) {
                return resolve(result);
            });
        });
    });
示例#15
0
function extractDownload(filePath, tmpPath) {
  var deferred = kew.defer();
  console.log('Extracting zip contents');
  extractZip(path.resolve(filePath), { dir: tmpPath }, function (err) {
    if (err) {
      deferred.reject('Error extracting archive: ' + err);
    } else {
      deferred.resolve(true);
    }
  });
  return deferred.promise;
}
示例#16
0
 return new Promise(function(resolve, reject) {
     var source = self.options.venvZipPath;
     var target = path.resolve(self.options.toolchainDir);
     extract(source, {dir: target}, function(error) {
       if (error) {
         reject(error);
       }
       else {
         resolve();
       }
     }
   );
 });
示例#17
0
      const unzipWithNode = () => {
        const endFn = (err) => {
          if (err) { return reject(err) }

          return resolve()
        }

        const obj = {
          dir: zipDestination,
          onEntry: tick,
        }

        return extract(downloadDestination, obj, endFn)
      }
示例#18
0
 function extractIcons(iconPath) {
   extract(iconPath, { dir: iconFolder }, function (err) {
     // extraction is complete. make sure to handle the err
     if (err) console.log(err);
     // remove icon.zip
     fs.unlink(iconPath, function (err1) {
       if (err1) {
         console.log(err1);
       }
       vscode.window.showInformationMessage(msg.enabled, { title: msg.restartIde })
         .then(function () {
           reloadWindow();
         });
     });
   });
 }
示例#19
0
文件: unzip.js 项目: YOU54F/cypress
        const unzipWithNode = () => {
          const endFn = (err) => {
            if (err) {
              return reject(err)
            }

            return resolve()
          }

          const opts = {
            dir: installDir,
            onEntry: tick,
          }

          return extract(zipFilePath, opts, endFn)
        }
示例#20
0
 downloader.assert_directory(dir, function () {
     var full_path = path.resolve(dir);
     console.log("unzipping to " + full_path);
     extract(downloader.tmp_file, {
         dir: full_path, onEntry: function () {
             entries++;
             progress(entries, false, null);
         }
     }, function (err) {
         if (err) {
             console.log("unzip error", err);
         }
         fs.unlink(downloader.tmp_file, function() { 
         progress(0, true, null);
         });
     });
 });
示例#21
0
nugget(downloadUrl, opts, function (err) {
    if (err) {
        console.error(err);
        return;
    }
    extract(path.join(cacheDir, target), {dir: cacheDir}, function (err) {
        if (err) {
            console.error(err);
            return;
        }
        fs.copySync(path.join(cacheDir, targetDir), copyDir, {clobber: true});
        fs.remove(cacheDir, function() {});
        var parserRoot = path.join(__dirname, 'parser', 'build', 'Release');
        //get around v8 version red bug
        fs.renameSync(path.join(parserRoot, 'jsjibonlu.node'), path.join(parserRoot, 'jsjibonlu.jibo'));
    });
});
示例#22
0
            .then(function () {

                gutil.log('Unzipping to ', options.private.outputDir);

                extract(options.private.filePath, {
                    dir: options.private.outputDir
                }, function (extractErr) {

                    if (extractErr) {
                        return cb(extractErr);
                    }

                    return cb(null);

                });

            });
示例#23
0
function extractDownload() {
  if (path.extname(downloadedFile) !== '.zip') {
    fs.copyFileSync(downloadedFile, path.resolve(tmpPath, 'chromedriver'));
    console.log('Skipping zip extraction - binary file found.');
    return Promise.resolve();
  }
  const deferred = new Deferred();
  console.log('Extracting zip contents');
  extractZip(path.resolve(downloadedFile), { dir: tmpPath }, function (err) {
    if (err) {
      deferred.reject('Error extracting archive: ' + err);
    } else {
      deferred.resolve(true);
    }
  });
  return deferred.promise;
}
示例#24
0
 return new Promise((resolve, reject) => {
   try {
     log.debug(`unzipFile check zipFile ${zipFile} fs.R_OK`);
     fs.accessSync(zipFile, fs.R_OK);
     log.debug(`Pass unzipFile file ${zipFile}`);
   } catch (e) {
     log.error(e);
     return reject(new AppError.AppError(e.message))
   }
   extract(zipFile, {dir: outputPath}, function(err){
     if (err) {
       log.error(err);
       reject(new AppError.AppError(`it's not a zipFile`))
     } else {
       log.debug(`unzipFile success`);
       resolve(outputPath);
     }
   });
 });
示例#25
0
        fsLib.zipFolder(symlinkPath, zipDestination, function (err) {
            if (err) {
                return done(err);
            }

            extract(zipDestination, {dir: unzipDestination}, function (err) {
                if (err) {
                    return done(err);
                }

                fs.readdir(unzipDestination, function (err, files) {
                    if (err) {
                        return done(err);
                    }

                    files.length.should.eql(13);
                    done();
                });
            });
        });
示例#26
0
function extractDownload(filePath, tmpPath) {
  var deferred = kew.defer()
  var options = { dir: fs.realpathSync(tmpPath) }

  try {
    extract(filePath, options, function (err) {
      if (err) {
        console.error(err)
        deferred.reject('Error extracting archive ' + err.stack)
      }
      else {
        console.log(filePath + ' extracted to ' + tmpPath)
        deferred.resolve(true)
      }
    });


  } catch (err) {
    deferred.reject('Error extracting archive ' + err.stack)
  }
  return deferred.promise
}
示例#27
0
          .run(( err, files ) => {
            if (err) {
              Log.err(err)
              fail();
              return;
            }

            Log.success('ifstat downloaded.')

            extract(__dirname + '/win32/ifstat-1.1-win32.zip',
              {dir: __dirname + '/win32'},
              function (err) {
                if (err) {
                  Log.err(err);
                  fail();
                  return;
                }
                Log.success('File is extracted')
                resolve();
            });

          });
    function openGridFile(scope, filePath, cb) {
      currentWorkbook.data.gridFilePath = filePath;
      currentWorkbook.data.currentSheet = '1';

      // file paths
      var splitFilePath = filePath.split('/');
      var parentDirectory = '/' +
        splitFilePath.slice(0, splitFilePath.length - 1).join('/');
      var gitFolderPath = filePath.replace('.grid', '/.git');
      var unzippedFolderPath = filePath.replace('.grid', '');
      var components = filePath.replace('.grid', '').split('/');
      var hiddenFolderPath = components.slice(0, components.length - 1).join('/') +
        '/.' + components[components.length - 1];

      currentWorkbook.data.tempFolderPath = hiddenFolderPath;

      extract(filePath, { dir: parentDirectory }, function(err){
        gift.getHistory(gitFolderPath, function(commits){
          currentWorkbook.data.gitCommits = commits;
          currentWorkbook.currentHash = commits[0];
          scope.$broadcast('git-commits-change');

          // cleanup temp files
          ncp(unzippedFolderPath, hiddenFolderPath, function(err){
            if (err) {
              return console.error(err);
            }

            rimraf(unzippedFolderPath, function(err){
              cb();
              if (err) throw err;
            });
          });

        });
      });
    }
示例#29
0
文件: install.js 项目: 6004x/jade
function extractDownload(filePath) {
  var deferred = kew.defer()
  // extract to a unique directory in case multiple processes are
  // installing and extracting at once
  var extractedPath = filePath + '-extract-' + Date.now()
  var options = {cwd: extractedPath}

  fs.mkdirsSync(extractedPath, '0777')
  // Make double sure we have 0777 permissions; some operating systems
  // default umask does not allow write by default.
  fs.chmodSync(extractedPath, '0777')

  if (filePath.substr(-4) === '.zip') {
    console.log('Extracting zip contents')
    extractZip(path.resolve(filePath), {dir: extractedPath}, function(err) {
      if (err) {
        console.error('Error extracting zip')
        deferred.reject(err)
      } else {
        deferred.resolve(extractedPath)
      }
    })

  } else {
    console.log('Extracting tar contents (via spawned process)')
    cp.execFile('tar', ['jxf', path.resolve(filePath)], options, function (err) {
      if (err) {
        console.error('Error extracting archive')
        deferred.reject(err)
      } else {
        deferred.resolve(extractedPath)
      }
    })
  }
  return deferred.promise
}
示例#30
0
文件: unzip.js 项目: a-labo/azip
 yield new Promise((resolve, reject) => {
   extractZip(src, { dir: dest }, (err) =>
     err ? reject(err) : resolve()
   )
 })