This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
OwlBoard/src/utils/corpus.utils.js

31 lines
876 B
JavaScript
Raw Normal View History

2022-12-06 01:20:43 +00:00
// 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`
2022-12-06 13:40:03 +00:00
const keys = require('/srv/keys/owlboard/keys.configs');
const axios = require('axios');
/*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) => {
console.log(response);
})
2022-12-06 01:20:43 +00:00
}
2022-12-06 13:40:03 +00:00
async function gunzipCorpus(){
// Extract the Corpus JSON from the GZIP Response
}
2022-12-06 01:20:43 +00:00
async function cleanCorpus(){
2022-12-06 13:40:03 +00:00
// Clean the CORPUS as per the temporary Python Script
2022-12-06 01:20:43 +00:00
}
module.exports = {
getCorpus
}