Gathering detailed insights and metrics for vbb-hafas
Gathering detailed insights and metrics for vbb-hafas
Gathering detailed insights and metrics for vbb-hafas
Gathering detailed insights and metrics for vbb-hafas
A JavaScript client for Berlin & Brandenburg public transport HAFAS API.
npm install vbb-hafas
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
33 Stars
309 Commits
4 Forks
2 Watchers
7 Branches
7 Contributors
Updated on Dec 21, 2024
Latest Version
8.0.1
Package Id
vbb-hafas@8.0.1
Unpacked Size
14.88 kB
Size
5.61 kB
File Count
9
NPM Version
8.19.3
Node Version
19.1.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
A client for the Berlin & Brandenburg public transport service (VBB). It acts as a consistent and straightforward interface on top of a verbose API.
This project is actually a thin wrapper around hafas-client@6
. Its docs document the API in general.
Note: You may not want to query the VBB API by yourself. vbb-client
is an API-compatible client for vbb-rest
, my wrapper API. It also works in the browser.
1npm install vbb-hafas
Check the docs for hafas-client
as well as its VBB-specific customisations.
1const createHafas = require('vbb-hafas') 2 3const hafas = createHafas('my-awesome-program')
As an example, we will search for a journey from Berlin Hauptbahnhof to Berlin Charlottenburg. To get the station IDs, use vbb-stations
.
1hafas.journeys('900000003201', '900000024101', {results: 1}) 2.then((journeys) => console.log(journeys[0])) 3.catch(console.error)
The output will be an array of journey
objects in the Friendly Public Transport Format 1.2.1
format:
1[ { 2 legs: [ { 3 tripId: '1|50420|0|86|25122017', 4 direction: 'Brandenburg, Hbf', 5 line: { 6 type: 'line', 7 id: '10', 8 name: 'RE1', 9 public: true, 10 mode: 'train', 11 product: 'regional', 12 symbol: 'RE', 13 nr: 1, 14 metro: false, 15 express: true, 16 night: false, 17 class: 64, 18 productCode: 6, 19 operator: { 20 type: 'operator', 21 id: 'db-regio-ag', 22 name: 'DB Regio AG' 23 } 24 }, 25 26 origin: { 27 type: 'station', 28 id: '900000003201', 29 name: 'S+U Berlin Hauptbahnhof', 30 location: { 31 type: 'location', 32 latitude: 52.52585, 33 longitude: 13.368928 34 }, 35 products: { 36 suburban: true, 37 subway: true, 38 tram: true, 39 bus: true, 40 ferry: false, 41 express: true, 42 regional: true 43 } 44 }, 45 departure: '2017-12-26T00:41:00.000+01:00', 46 plannedDeparture: '2017-12-26T00:41:00.000+01:00', 47 departureDelay: 0, 48 departurePlatform: '14', 49 plannedDeparturePlatform: '13', 50 51 destination: { 52 type: 'station', 53 id: '900000024101', 54 name: 'S Charlottenburg', 55 location: { 56 type: 'location', 57 latitude: 52.504806, 58 longitude: 13.303846 59 }, 60 products: { 61 suburban: true, 62 subway: false, 63 tram: false, 64 bus: true, 65 ferry: false, 66 express: false, 67 regional: true 68 } 69 }, 70 arrival: '2017-12-26T00:50:00.000+01:00', 71 plannedArrival: '2017-12-26T00:50:00.000+01:00', 72 arrivalDelay: null, 73 arrivalPlatform: '4', 74 plannedArrivalPlatform: '4' 75 } ], 76 77 // all these are from the first leg 78 origin: { 79 type: 'station', 80 id: '900000003201', 81 name: 'S+U Berlin Hauptbahnhof' 82 // … 83 }, 84 departure: '2017-12-26T00:41:00.000+01:00', 85 plannedDeparture: '2017-12-26T00:41:00.000+01:00', 86 departureDelay: 0, 87 departurePlatform: '14', 88 plannedDeparturePlatform: '13', 89 90 // all these are from the last leg 91 destination: { 92 type: 'station', 93 id: '900000024101', 94 name: 'S Charlottenburg' 95 // … 96 }, 97 arrival: '2017-12-26T00:50:00.000+01:00', 98 plannedArrival: '2017-12-26T00:50:00.000+01:00', 99 arrivalDelay: null, 100 arrivalPlatform: '4', 101 plannedArrivalPlatform: '4' 102 103 // … 104} ]
vbb-hafas
will try to add transfer information from vbb-change-positions
if you pass transferInfo: true
as an option.
If it identifies a known transfer, the previous leg will have a bestArrivalPosition
and the next leg will have a departurePosition
, indicating the optimal transfer between both platforms. Check out the markup in vbb-change-positions
for more details.
Check hafas-client
's related projects.
If you have a question, found a bug or want to propose a feature, have a look at the issues page.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More