Add comments

This commit is contained in:
Fred Boniface 2022-12-08 11:03:33 +00:00
parent a00c7af2e0
commit cc8dcd864c
2 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,11 @@
// 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`
// FUNCTIONS
// get() : Exported: Returns: Ready Status and Owlboard Version
// post() : Exported: Will check the API authentication and return status
const version = require('../configs/version.configs'); const version = require('../configs/version.configs');
async function get(){ async function get(){

View File

@ -12,12 +12,12 @@ const keys = require('/srv/keys/owlboard/keys.configs');
const axios = require('axios'); const axios = require('axios');
const zlib = require('zlib'); const zlib = require('zlib');
async function initCorpus(){ // EXPORT - Uses getCorpus() to download the CORPUS GZIP and then processes it. async function initCorpus() {
let gzipData = await getCorpusAgain(); let gzipData = await getCorpusAgain();
console.log(gzipData); console.log(gzipData);
} }
async function getCorpus(){ // Download and return the GZIP file as an arraybuffer. async function getCorpus() {
authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64'); authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64');
const options = { const options = {
method: 'get', method: 'get',
@ -30,7 +30,7 @@ async function getCorpus(){ // Download and return the GZIP file as an arraybuff
console.log(download); console.log(download);
} }
async function getCorpusAgain(){ //Try to get CORPUS then pipe to zlib and return uncompressed date async function getCorpusAgain() {
authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64'); authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64');
const decomp = zlib.createGunzip(); const decomp = zlib.createGunzip();
const getReq = axios.create({ const getReq = axios.create({
@ -53,8 +53,20 @@ async function getCorpusAgain(){ //Try to get CORPUS then pipe to zlib and retur
}) })
} }
async function cleanCorpus(){ async function init() {
// Clean the CORPUS as per the temporary Python Script
}
async function get() {
}
async function extract() {
}
async function clean() {
} }
module.exports = { module.exports = {