Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
.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");
});
});
});
};
'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);
}
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();
}
});
}
});
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);});
}
[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();
});
}
}
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) {
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({
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();
}
});
}