Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
updateOpts()
stream = source.createReadStream(opts)
}
const pipeline = [
// any index
stream,
through.obj(function (data, enc, cb) {
if (data.type === 'del') cb()
else cb(null, data.value) // figure out how to make it store utf8
}),
getEntry()
]
return pump.apply(null, pipeline)
function updateOpts () {
utils.extend(opts, getRangeOpts(index, prop, value))
}
}
if (!res) return next(new Error('no res'))
if (res.statusCode !== 200) return next(new Error('downloading returned ' + res.statusCode))
// Consider using res.headers for verifying content-length and content-disposition for saveTo
res.on('error', next)
res.on('data', function (d) { len += d.length; hash.update(d) })
var pipes = [stream]
if (update.ungzip) pipes.push(gunzip())
if (update.untar) pipes.push(tar.extract(saveTo, { fs: fs }))
else pipes.push(fs.createWriteStream(saveTo))
pump.apply(null, pipes.concat([ function (err) { next(err) } ]))
})
},
if (options.filter || options.offset) {
streams.push(filterStream({
filter: options.filter
, offset: options.offset
}));
}
if (options.materialized) {
streams.push(materializer({
pattern: options.materialized
}));
}
streams.push(result);
pump.apply(null, streams);
});
function executePipeline (pipeline) {
return pipeline.length === 1 ? pipeline[0] : pump.apply(null, pipeline)
}