Skip to content
Pass in a HAFAS client, discover stations by querying departures.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitignore
.travis.yml
bin.js
example.js
index.js
license.md
package.json
readme.md
test.js

readme.md

hafas-discover-stations

Pass in a HAFAS client, discover stops/stations by querying departures. It tries to find all stops/stations that all trains known by the endpoint stop at.

npm version build status ISC-licensed chat on gitter support me on Patreon

Installing

npm install hafas-discover-stations

Usage

const createWalk = require('hafas-discover-stations')
const createHafas = require('db-hafas')

const hafas = createHafas('my-awesome-program')
const walk = createWalk(hafas)

const berlinFriedrichstr = '8011306' // where to start
walk(berlinFriedrichstr)
.on('data', console.log)
.on('error', console.error)

walk() returns a readable stream in object mode. It emits the following events:

API

walk(stationId, [opt])

opt may have the following keys. It will be passed into queue().

  • concurrency: number of requests run in parallel – default: 2
  • timeout: timeout for a single job in milliseconds – default: 10000
  • parseStationId: an optional function to process station IDs – default: id => id

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

You can’t perform that action at this time.