How to use the decompress.zip function in decompress

To help you get started, we’ve selected a few decompress 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 repetere / periodicjs / __LEGACY / app / controller / theme.js View on Github external
var move_upload = function (options) {
	// console.log('options',options);
	var logfile = options.logfile,
		themename = options.themename;
	// fs.rename(returnFile.path,newfilepath,function(err){
	// });
	var decompress = new Decompress()
		.src(options.uploadedfile.path)
		.dest(options.themedir)
		.use(Decompress.zip());
	decompress.decompress(function (err
		//, files
	) {
		if (err) {
			install_logErrorOutput({
				logfile: logfile,
				logdata: err.message
			});
		}
		else {
			install_logOutput({
				logfile: logfile,
				logdata: 'unzipped directory'
			});
			fs.remove(options.uploadedfile.path, function (err
				//, filedir
github bchr02 / instantclient / instantclient.js View on Github external
.on('close', function() {
		new Decompress()
			.src(fullPathToFile)
			.dest(dir)
			.use(Decompress.zip({strip: 1}))
			.run(function(error) {
				if(error) {
					console.error(error);
					return;
				}
				console.log(fn + " extracted");
				fs.unlink(fullPathToFile, function(error) {
					if(error) {
						console.error(error);
						return;
					}
					console.log(fn + " deleted");
				});
			});
	});
};
github lando / lando / modules / jxcore / scripts / install.js View on Github external
'jx_' + getPkgType() + 'v8.zip'
].join('/');

var dest = path.resolve(__dirname, '..', 'bin');
rimraf.sync(dest);

var parsedUrl = urlModule.parse(url);
var decompressOptions = {strip: 1, mode: '755'};
if (parsedUrl.protocol === 'file:') {
  if (fileExists(parsedUrl.path)) {
    logError('Could not find ' + parsedUrl.path);
  }
  new Decompress()
    .src(parsedUrl.path)
    .dest(dest)
    .use(Decompress.zip(decompressOptions))
    .use(Decompress.targz(decompressOptions))
    .run(cb);
} else {
  new Download(merge({extract: true}, decompressOptions))
    .get(url)
    .dest(dest)
    .run(cb);
}
github guerrerocarlos / nw-updater / index.js View on Github external
rm(installDir, function(err) {
        if(err) {
            defer.reject(err);
        } else {
            //var pack = new zip(downloadPath);
            var decompress = Decompress({mode: '744'})
                .src(downloadPath)
                .dest(installDir)
                .use(Decompress.zip())


            //pack.extractAllToAsync(installDir, true, function(err) {
            decompress.run(function(err){
                if(err) {
                    defer.reject(err);
                } else {
                    fs.unlink(downloadPath, function(err) {
                        if(err) {
                            defer.reject(err);
                        } else {
                            defer.resolve();
                        }
                    });
                }
            });
github nwjs / npm-installer / scripts / install.js View on Github external
var parsedUrl = urlModule.parse(url);
var decompressOptions = { strip: 1, mode: '755' };
var filePath;
if( parsedUrl.protocol == 'file:' ) {
  filePath = path.resolve(
    decodeURIComponent(
      url.slice( 'file://'.length )
    )
  );
  if ( !fileExistsAndAvailable(filePath) ) logError(
    'Could not find ' + filePath
  );
  new Decompress()
    .src( filePath )
    .dest( dest )
    .use( Decompress.zip(decompressOptions) )
    .use( Decompress.targz(decompressOptions) )
    .run( cb );
} else {
  download(url, dest, merge({ extract: true }, decompressOptions))
    .then(function() {cb();})
    .catch(function(e) {cb(e);});
}
github FreeAllMedia / akiro / es6 / lib / akiro.js View on Github external
[unzipLocalFile](localFileName, outputDirectoryPath, callback) {
		this.debug(`unzipping completed package zip file: ${localFileName}`, {
			outputDirectoryPath
		});

		const moduleName = path.basename(localFileName, ".zip").replace(/-\d*\.\d*\.\d*$/, "");

		new Decompress({mode: "755"})
			.src(localFileName)
			.dest(`${outputDirectoryPath}/${moduleName}`)
			.use(Decompress.zip({strip: 1}))
			.run(() => {
				this.debug("completed package zip file unzipped", {
					localFileName,
					outputDirectoryPath
				});
				callback();
			});
	}
}
github theintern / digdug / Tunnel.js View on Github external
function (response) {
					var decompressor = new Decompress();
					decompressor.src(response.data)
						.use(Decompress.zip())
						.use(Decompress.targz())
						.dest(self.directory)
						.run(function (error) {
							if (error) {
								reject(error);
							}
							else {
								resolve();
							}
						});
				},
				function (error) {
github repetere / periodicjs / app / controller / extension.js View on Github external
var move_upload = function (options) {
	var logfile = options.logfile,
		extname = options.extname,
		extdir = options.extdir;
	var decompress = new Decompress()
		.src(options.uploadedfile.path)
		.dest(extdir)
		.use(Decompress.zip());
	decompress.decompress(function (err, files) {
		if (err) {
			install_logErrorOutput({
				logfile: logfile,
				logdata: err.message
			});
		}
		else {
			logger.silly('files', files);
			install_logOutput({
				logfile: logfile,
				logdata: 'unzipped directory'
			});
			fs.remove(options.uploadedfile.path, function (err, filedir) {
				if (err) {
					install_logErrorOutput({
github guerrerocarlos / nw-updater / index.js View on Github external
function installWindows2(downloadPath, updateData) {
    var outputDir = path.dirname(downloadPath),
        installDir = path.join(outputDir, 'app');
    var defer = Q.defer();


    var decompress = Decompress({mode: '644'})
        .src(downloadPath)
        .dest(installDir)
        .use(Decompress.zip())

    //var pack = new zip(downloadPath);
    decompress.run(
    //pack.extractAllToAsync(installDir, true, function(err) {
    function(err) {
        if(err) {
            defer.reject(err);
        } else {
            fs.unlink(downloadPath, function(err) {
                if(err) {
                    defer.reject(err);
                } else {
                    defer.resolve();
                }
            });
        }

decompress

Extracting archives made easy

MIT
Latest version published 5 years ago

Package Health Score

65 / 100
Full package analysis