Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('getOfflineReference', function(){
// get latest .zip data from p5js website and unzip it.
request('http://p5js.org/offline-reference/p5-reference.zip')
// .pipe(fs.createWriteStream('./public/mode_assets/p5/p5-reference.zip'))
.pipe(unzip.Extract({ path: './public/mode_assets/p5/p5-reference' }))
.on('close', function () {
console.log('Offline Reference Retrieved!');
});
})
response.data.pipe(fs.createWriteStream(local)).on('finish', (done) => {
fs.createReadStream(local).pipe(unzip.Extract({ path: 'decompress' })).on('close', (done) => __awaiter(this, void 0, void 0, function* () {
// await sleep(2000);
console.log('extracted ...');
fs.unlinkSync(local);
console.log('deleted zip file ...');
yield removeFolder(generatedFolder);
console.log('removed generated ...');
// await sleep(1000);
fs.renameSync(templateFolder, generatedFolder);
console.log('copy generated ...');
yield removeFolder(decompress);
console.log('done ...');
}));
});
}
response.data.pipe(fs.createWriteStream(local)).on('finish', (done: any) => {
fs.createReadStream(local).pipe(unzip.Extract({ path: 'decompress' })).on('close',
async (done: any) => {
// await sleep(2000);
console.log('extracted ...');
fs.unlinkSync(local);
console.log('deleted zip file ...');
await removeFolder(generatedFolder);
console.log('removed generated ...');
// await sleep(1000);
fs.renameSync(templateFolder, generatedFolder);
console.log('copy generated ...');
await removeFolder(decompress);
console.log('done ...');
});
});
}
return new Promise((resolve, reject) => {
console.log('unziping', file, 'to', path)
fs.createReadStream(file).pipe(uz.Extract({ path })).on('close', () => {
console.log('unziped!')
resolve()
})
})
}
https.get(PROTOBUF_URL, (res) => {
if (res.statusCode !== 200) {
throw new Error(PROTOBUF_URL + ' ' + res.statusMessage);
} else {
console.log('Done,', PROTOBUF_URL + ' is finished downloaded.');
}
res.pipe(unzip.Extract({
path: './protobuf'
}));
});
function processFile(e, response, body){
if(response && response.statusCode != 200){ cb(new Error('Couldn\'t download files')); }
console.log(agency_key + ': Download successful');
fs.createReadStream(downloadDir + '/latest.zip')
.pipe(unzip.Extract({ path: downloadDir }).on('close', cb))
.on('error', handleError);
}
}
ZipTools.prototype.extract = function (archiveName, cb, targetDir) {
if ( targetDir === undefined ) {
targetDir = downloadTools.getDirectoryPath() + archiveName.replace(/_[A-Z]+\..+$/, '');
}
console.log(' Extracting ' + archiveName + ' to directory...');
fs.createReadStream(downloadTools.getDirectoryPath() + archiveName)
.pipe(
unzip.Extract({
path: targetDir
})
.on('close', () => {
console.log(' Finished extracting ' + archiveName + '.');
if (cb) cb();
})
);
};
}.bind(this), function onEnd(file, path) {
fs.createReadStream(file).pipe(UnZIP.Extract({
path: path
}).on('finish', function Finish() {
fs.unlink(file, function onSuccess() {
this.getScreen('SteamWorkshop').send('steam:workshop:event', {
action: 'installed',
id: data.id
});
this.getScreen('SteamWorkshopDetails').send('steam:workshop:event', {
action: 'installed',
id: data.id
});
}.bind(this));
}.bind(this)));
}.bind(this));
}.bind(this));
function(cb_) {
fs.createReadStream(path.join(THRUST_PATH, THRUST_RELEASE_FILENAME))
.on('error', cb_)
.pipe(unzip.Extract({
path: THRUST_PATH
}).on('close', cb_));
},
function(cb_) {