Try decompress CORPUS

This commit is contained in:
Fred Boniface 2022-12-07 01:28:00 +00:00
parent b776e39d45
commit 1bdd18eb21
1 changed files with 7 additions and 4 deletions

View File

@ -4,8 +4,9 @@
const keys = require('/srv/keys/owlboard/keys.configs'); const keys = require('/srv/keys/owlboard/keys.configs');
const axios = require('axios'); const axios = require('axios');
const zlib = require('zlib');
/*async*/ function getCorpus(){ 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');
getOpts = { getOpts = {
method: 'get', method: 'get',
@ -14,12 +15,14 @@ const axios = require('axios');
headers: {'Authorization': `Basic ${authHead}`} headers: {'Authorization': `Basic ${authHead}`}
} }
axios(getOpts).then((response) => { axios(getOpts).then((response) => {
console.log(response); decompress(response);
console.log(raw);
}) })
} }
async function gunzipCorpus(){ async function decompress(data){
// Extract the Corpus JSON from the GZIP Response let raw = zlib.gunzip(data);
return raw;
} }
async function cleanCorpus(){ async function cleanCorpus(){