Neolithic Populous Metropolis
Have ideas to improve npm?Join in the discussion! »

@openrailuk/referencedataTypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

country license npm (scoped) status pipeline coverage slack

A package for accessing the the UK National Rails reference data FTP server as well as some helper functions to process and use the reference data

info

This repository is hosted on GitLab as reference-nodejs. The GitHub repository is a downstream repository where all changes from GitLab are pushed. Please raise any issues or pull requests on the GitLab repository.

installation

  1. install npm
  2. npm install @openrailuk/referencedata --save

table of contents

getting started

this package downloads and parses the xml reference data from the National Rail ftp server and parses into JSON for use on a Node.JS application. The package also provide some helper functions for retrieving the reference data.

the reference data contains information about locations, train operating companies, reason codes, and daily timetables among other information for the UK rail network.

to use @openrailuk/referencedata you first need to supply the ftp password for your account found on the my feeds section of the National Rail Data Portal

const { referenceData } = require('@openrailuk/referencedata');
 
referenceData.connect('ftpUserPassword');

a simple example of getting the v3 reference data:

const { referenceData } = require('@openrailuk/referencedata');
 
referenceData.connect('ftpUserPassword');
referenceData.on('dataReady', () => {
  referenceData.getCurrentV3()
    .then((v3RefData) => {
      console.log(v3RefData);
    })
    .catch((err) => {
      console.log(err);
    });
});

package docs

code docs found here

dev notes

Hi :D

this package is being coded while im experimenting so feel free to use it however it may change at any moment. I'm publishing it as i go so not all features will be there.

I'm generaly only working on this while im sat on the train too and from my day job so this may take a while

Install

npm i @openrailuk/referencedata

DownloadsWeekly Downloads

2

Version

2.0.4

License

MIT

Unpacked Size

426 kB

Total Files

128

Last publish

Collaborators

  • avatar