A NodeJS wrapper for the TfL Unified API, made with TypeScript.
Read the Documentation
npm install tfl-api-wrapper
yarn add tfl-api-wrapper
There are many ways to contribute to this repo.
- Submit bugs and help us verify fixes as they are checked in.
- Review the source code changes.
import { StopPoint } from 'tfl-api-wrapper';
const app_key = 'API KEY HERE'; // Use an environment file
const app_key_trackernet = 'API KEY HERE'; // Optional: Only required if using Trackernet, Use an environment file
const stopPoint = new StopPoint(app_key)
const trackerNet = new TrackerNet(_, app_key_trackernet)
const arrivals = await stopPoint.getStationArrivals('940GZZLUKSX');
const predicitionSummary = await trackerNet.getPredictionSummary(TrackerNetLines.Bakerloo)
console.log(arrivals);
console.log(predicitionSummary);
import { StopPoint } from 'tfl-api-wrapper';
const app_key = 'API KEY HERE'; // Use an environment file
const app_key_trackernet = 'API KEY HERE'; // Optional: Only required if using Trackernet, Use an environment file
const stopPoint = new StopPoint(app_key)
const trackerNet = new TrackerNet(_, app_key_trackernet)
stopPoint.getStationArrivals('940GZZLUKSX').then((arrivals) => {
console.log(arrivals);
});
const predicitionSummary = trackerNet.getPredictionSummary(TrackerNetLines.Bakerloo).then((summary) => {
console.log(summary);
});
This repository is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Transport for London (TfL) or its parent organisation Greater London Authority (GLA)