Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lzma.compress("Bananas", 6, result => {
lzma.decompress(result, undefined, decompressedResult => {
console.log(decompressedResult.toString() === "Bananas");
});
});
new Promise(async (resolve, reject) => {
const zipFilePath = `${path.join(SOLA_HASH_PATH, relativePath)}.xml.xz`;
console.log(`Loading ${zipFilePath} into solr`);
console.log("Unzipping files");
const zipFile = fs.readFileSync(zipFilePath);
const data = await lzma.decompress(zipFile);
console.log("Parsing xml");
const hashList = new xmldoc.XmlDocument(data).children
.filter(child => child.name === "doc")
.map(doc => {
const fields = doc.children.filter(child => child.name === "field");
return {
time: parseFloat(
fields.filter(field => field.attr.name === "id")[0].val
),
cl_hi: fields.filter(field => field.attr.name === "cl_hi")[0].val,
cl_ha: fields.filter(field => field.attr.name === "cl_ha")[0].val
};
})
.sort((a, b) => a.time - b.time);