Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getBattutaStream () {
if (!_battuta) {
const requestObject = request({url: stationsLink});
_battuta = DataStream
.pipeline(
requestObject,
JSONStream.parse('*')
)
.catch(e => {
requestObject.abort();
e.stream.end();
throw e;
})
.keep(Infinity);
}
return _battuta.rewind();
}