npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uk-trains

v1.0.1

Published

A tiny NodeJS wrapper for the National Rail SOAP api, requiring only node-soap.

Downloads

47

Readme

uk-trains

A tiny NodeJS wrapper for the National Rail SOAP api, requiring only node-soap.

The National Rail SOAP api is pretty nasty to get your head around for someone used to a RESTful architecture. This wrapper aims to simplify the experience using callbacks and json.

Usage

Go to http://realtime.nationalrail.co.uk/OpenLDBWSRegistration/ and register for an api key.

After that, install this package. npm i uk-trains

Within your NodeJS app, load the package, supply your api key, and then use the returned service.

var ukTrains = require('uk-trains');
var rail = ukTrains('xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx')

rail.getDepartures('MYB', undefined, console.log);

Public methods:

getDepartures(fromStation, options, callback)

Get Departures from a specific station. Optionally you can request where the services depart to, how many services to request, and whether to include specific details about each train.

fromStation (String) the three letter station code you are requesting departures from

options (Object) optional or undefined

toStation: (String) the three letter station code you are requesting departures to
count: 20 (Number) the maximum number of services to request
includeServiceDetails: (Boolean) the api can also return information about each service (train) This is usually a long request, so only use it when you need it

callback (Function) Function to call with the result upon completion of the request

getArrivals(atStation, options, callback)

Get arrivals at a specific station. Optionally you can request where the services are arriving from, how many services to request, and whether to include specific details about each train.

atStation (String) the three letter station code you are requesting arrivals at

options (Object) optional or undefined

fromStation: (String) the three letter station code you are requesting departures to
count: 20 (Number) the maximum number of services to request
includeServiceDetails: (Boolean) the api can also return information about each service (train) This is usually a long request, so only use it when you need it

callback (Function) Function to call with the result upon completion of the request

getAll(station, options, callback)

Get all services relating to a station. Optionally you can request how many services to request, and whether to include specific details about each train.

station (String) the three letter station code you are requesting services at

options (Object) optional or undefined

count: 20 (Number) the maximum number of services to request
includeServiceDetails: (Boolean) the api can also return information about each service (train) This is usually a long request, so only use it when you need it

callback (Function) Function to call with the result upon completion of the request

getServiceDetails(serviceID, callback)

Get specific details about an individual service (train).

serviceID (String) the service code you are requesting details regarding

callback (Function) Function to call with the result upon completion of the request