From cc8dcd864c3bdbe2b1d9af4885fe3c54afddbf7f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 8 Dec 2022 11:03:33 +0000 Subject: [PATCH] Add comments --- src/services/test.services.js | 8 ++++++++ src/utils/corpus.utils.js | 22 +++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/services/test.services.js b/src/services/test.services.js index 350ee0c..a5932fd 100644 --- a/src/services/test.services.js +++ b/src/services/test.services.js @@ -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'); async function get(){ diff --git a/src/utils/corpus.utils.js b/src/utils/corpus.utils.js index 8452cea..32bcede 100644 --- a/src/utils/corpus.utils.js +++ b/src/utils/corpus.utils.js @@ -12,12 +12,12 @@ const keys = require('/srv/keys/owlboard/keys.configs'); const axios = require('axios'); 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(); 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'); const options = { method: 'get', @@ -30,7 +30,7 @@ async function getCorpus(){ // Download and return the GZIP file as an arraybuff 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'); const decomp = zlib.createGunzip(); const getReq = axios.create({ @@ -53,8 +53,20 @@ async function getCorpusAgain(){ //Try to get CORPUS then pipe to zlib and retur }) } -async function cleanCorpus(){ - // Clean the CORPUS as per the temporary Python Script +async function init() { + +} + +async function get() { + +} + +async function extract() { + +} + +async function clean() { + } module.exports = {