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); }); })
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) }) })
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); }); });
function unzip(inputPath, outputPath, callback) { if (!fs.existsSync(inputPath)) { callback({ error: "The file doesn't exist!" }); return; } extract(inputPath, { dir: outputPath }, callback); }
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) }) })
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() }) })
// 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(); } }
req(file.url, (err, resp, body) => { extract(zipFile, {dir: targetDir}, (err) => { if(fs.existsSync(zipFile)) { fs.unlink(zipFile) } callback(err) }) }).on('data', (data) => {
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); });
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); }); }); });
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); }); }); });
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; }
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(); } } ); });
const unzipWithNode = () => { const endFn = (err) => { if (err) { return reject(err) } return resolve() } const obj = { dir: zipDestination, onEntry: tick, } return extract(downloadDestination, obj, endFn) }
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(); }); }); }); }
const unzipWithNode = () => { const endFn = (err) => { if (err) { return reject(err) } return resolve() } const opts = { dir: installDir, onEntry: tick, } return extract(zipFilePath, opts, endFn) }
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); }); }); });
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')); }); });
.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); }); });
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; }
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); } }); });
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(); }); }); });
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 }
.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; }); }); }); }); }
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 }
yield new Promise((resolve, reject) => { extractZip(src, { dir: dest }, (err) => err ? reject(err) : resolve() ) })