Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.
/ db-train-numbers Public archive

UNMAINTAINED AND PROBABLY NOT WORKING ANYMORE. Fetch DB long distance train numbers for a given time interval.

License

Notifications You must be signed in to change notification settings

juliuste/db-train-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

db-train-numbers

Fetch DB long distance train numbers for a given time interval.

npm version Build Status Greenkeeper badge dependency status license chat on gitter

Installation

npm install --save db-train-numbers

Usage

const trainNumbers = require('db-train-numbers')

const start = new Date('2018-06-19T05:30:00')
const end = new Date('2018-06-19T08:30:00')

const opt = { // defaults
    interval: 10 // lookup train numbers every * minutes between start and end    
}

trainNumbers(start, end, opt)
.then(console.log)
.catch(console.error)

Returns a Promise that will resolve in an array of train objects which looks as follows:

[
    {
        train: "IC 11840",
        journeyRef: "84/326594/18/19/80",
        lastDeparture: "2018-06-19T03:21:00.000Z"
    },
    {
        train: "IC 528",
        journeyRef: "84/324965/18/19/80",
        lastDeparture: "2018-06-19T03:24:00.000Z"
    },
    {
        train: "EN 40467",
        journeyRef: "84/267796/18/19/80",
        lastDeparture: "2018-06-18T03:12:00.000Z"
    },
    {
        train: "IC 516",
        journeyRef: "84/257824/18/19/80",
        lastDeparture: "2018-06-19T03:24:00.000Z"
    },
    {
        train: "IC 3518",
        journeyRef: "84/252900/18/19/80",
        lastDeparture: "2018-06-19T03:33:00.000Z"
    },
    {
        train: "ICE 71",
        journeyRef: "84/215926/18/19/80",
        lastDeparture: "2018-06-19T03:18:00.000Z"
    },
    {
        train: "EC 7",
        journeyRef: "84/215818/18/19/80",
        lastDeparture: "2018-06-19T02:49:00.000Z"
    }
    // …
]

Fetch further information for trains using the journeyRef attribute and the journeyLeg method provided by the db-hafas module.

You can use the lastDeparture attribute with the db-wagenreihung module.

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.

About

UNMAINTAINED AND PROBABLY NOT WORKING ANYMORE. Fetch DB long distance train numbers for a given time interval.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published