Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TarGz.prototype.createParseStream = function() {
var stream1 = zlib.createGunzip(this._options.zlib);
var stream2 = tar.Parse();
this._bubble(stream1, stream2);
// Capture the entry event
stream2.on('entry', function(entry) {
stream1.emit('entry', entry);
});
stream1.pipe(stream2);
return stream1;
};
var fs = require('fs');
var tar = require('tar-fs')
var request = require('request');
var zlib = require('zlib');
request('https://www.dropbox.com/s/4h5iuryd3myfha8/asset.tar.gz?dl=1')
.pipe(zlib.createGunzip())
.pipe(tar.extract('./static_assets'));
function main() {
extractValues(
fs.createReadStream(__dirname + '/ucd.all.flat.xml.gz').pipe(zlib.createGunzip()),
propertiesToExtract,
writeFile);
function writeFile(validRanges) {
var code = generateCode(validRanges);
try {
fs.lstatSync(__dirname + '/../../../src/ngParseExt');
} catch (e) {
fs.mkdirSync(__dirname + '/../../../src/ngParseExt');
}
fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code);
}
}
req.on('response', resp => {
if (resp.statusCode === 200)
req.pipe(zlib.createGunzip()).pipe(fs.createWriteStream(ipFile))
.on('finish', () => {
loadFile(resolve)
})
else
loadFile(resolve)
})
} else
replicator.replicateFromSnapShotStream = function (readStream, indexes, callback) {
var indexesws = levelws(indexes);
readStream.pipe(zlib.createGunzip())
.pipe(JSONStream.parse())
.pipe(indexesws.createWriteStream())
.on('close', callback);
};
http.get(url, function(res) {
if(res.statusCode != "200") {
return callback(new Error("HTTP error: " + res.statusCode));
}
var gunzip = zlib.createGunzip();
var out = fs.createWriteStream(path);
res.pipe(gunzip).pipe(out);
gunzip.on('end', function(err) {
callback(err);
});
});
};
TarGz.prototype.createWriteStream = function(directory) {
var stream1 = zlib.createGunzip(this._options.zlib);
var stream2 = tar.Extract({
path: directory,
strip: this._options.tar.strip || 0
});
this._bubble(stream1, stream2);
stream1.pipe(stream2);
return stream1;
};
return new Promise(function (resolve, reject) {
var uncompressed_bytes = [];
var gunzip = zlib.createGunzip();
gunzip.on('data', function (data) {
uncompressed_bytes.push(data.toString());
}).on("end", function () {
resolve(uncompressed_bytes.join(""));
}).on("error", function (e) {
reject(e);
});
var bufferStream = new stream.PassThrough();
bufferStream.end(buffer);
bufferStream.pipe(gunzip);
});
};
http.get(url, function(res){
var gunzip = zlib.createGunzip();
res.pipe(gunzip);
gunzip.on('data', function(data){
buffer.push(data.toString())
}).on("end", function(){
try {
callback(null, JSON.parse(buffer.join('')));
} catch (e) {
callback(e);
}
}).on("error", function(e){
callback(e);
});
}).on('error', function(e){
callback(e)