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