Transform a continuous GTFS Realtime (GTFS-RT) stream of DIFFERENTIAL
incrementality data into a FULL_DATASET
dump.
Note: Right now, this package does not obey the draft DIFFERENTIAL
spec exactly. See below and #1 for details.
npm install gtfs-rt-differential-to-full-dataset
const toFullDataset = require('gtfs-rt-differential-to-full-dataset')
const toFull = toFullDataset({
ttl: 2 * 60 * 1000, // 2 minutes
})
toFull.on('error')
differentialFeedEntities.pipe(toFull)
setInterval(() => {
console.log(toFull.asFeedMessage())
}, 5000)
toFull
will be a writable stream in object mode that expects JS objects in the FeedEntity
structure/format.
toFull.asFeedMessage()
returns a protocol-buffer-encoded FeedMessage
with all relevant FeedEntity
s that have been written into toFull
so far.
toFull.nrOfEntities()
returns the number of FeedEntity
s that are currently part of the FeedMessage
.
If you have a question or have difficulties using gtfs-rt-differential-to-full-dataset
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.