How to use the lzma-native.decompress function in lzma-native

To help you get started, we’ve selected a few lzma-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / lzma-native / lzma-native-tests.ts View on Github external
lzma.compress("Bananas", 6, result => {
    lzma.decompress(result, undefined, decompressedResult => {
        console.log(decompressedResult.toString() === "Bananas");
    });
});
github soruly / sola / src / lib / load.js View on Github external
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);