TFL - Node
This is a node package for interacting with the Transport for London (TFL) api.
It comes with a tool for accessing this data directly via the command line, or can be used within your own projects.
Installation
Install with:
$ npm install -g tfl
move binary to /usr/local/bin ?
Command-line Tool
Tube
Line Status
$ tfl tube --line District
Station Status
$ tfl tube --station Aldgate East
Overground (Work in Progress)
$ tfl overground --station London Bridge
Buses (Work in Progress)
$ tfl bus --route 66
Cycle Hire (Work in Progress)
$ tfl cycle ...
Roads (Work in Progress)
Road Status
$ tfl road --name Park Lane
Route Status This will perform a search for the typical route taken between two roads and retrieve the statuses for each road on the route.
$ tfl road --from "Whitechapel Road" --to "Park Lane"
Road Traffic Cam
$ tfl road --camera Park Lane
Using the package in your own projects
Require the tfl package as usual:
var tfl = ;
Since each command sends a request to the TFL api, the response is returned in a promise. For example, to get the current list of incidents on tube lines you can call:
tfltubestatus 'incidents': true;
The function passed into then()
will be called asynchronously once the request to the api has returned and been processed.
Services
Tube / Overground
Status
tfltubestatus;tflovergroundstatus;
Incidents
tfltubestatus 'incidents': true ;tflovergroundstatus 'incidents': true ;
Line (Work in Progress)
tfltube;// Overground services do not provide line information
Station (Work in Progress)
tfltube;tfloverground;
Arrivals (Work in Progress)
tfltube;// overground?
Journey (Work in Progress)
tfltube;tfloverground;
Bus
...
Cycle
...
Road
...