// Get CORPUS data from Network Rail and format the data for OwlBoard // Username and password must be stored in `/srv/keys/owlboard/keys.config.js` const keys = require('/srv/keys/owlboard/keys.configs'); const axios = require('axios'); const zlib = require('zlib'); async function getCorpus(){ authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64'); getOpts = { method: 'get', url: 'https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS', timeour: 3000, headers: {'Authorization': `Basic ${authHead}`} } axios(getOpts).then((response) => { decompress(response); console.log(raw); }) } async function decompress(data){ let raw = zlib.gunzip(data); return raw; } async function cleanCorpus(){ // Clean the CORPUS as per the temporary Python Script } module.exports = { getCorpus }