# node-xz **Repository Path**: mirrors_addaleax/node-xz ## Basic Information - **Project Name**: node-xz - **Description**: node bindings for the xz (LZMA2) compression library, using streams - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-02-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README xz == Xz is the node binding for the xz library, which implements (streaming) LZMA2 compression. LZMA2 is better than gzip & bzip2 in many cases. Read more about LZMA here: http://en.wikipedia.org/wiki/Lempel-Ziv-Markov_chain_algorithm Install ------- ```sh $ npm install $ npm run test ``` API --- The API consists of only two stream transform classes: `Compressor` and `Decompressor`. - `new xz.Compressor([preset], [options])` - `new xz.Decompressor([options])` The options object is passed to node's `Transform`. Compression takes a "preset" number, which is an abstraction of the compression difficulty level, from 1 to 9, where 1 puts in the least effort. The default is 6. Both objects are stream transforms that consume and produce Buffers. Here's example code to compress the sample file included with this distribution: ```javascript var fs = require("fs"); var xz = require("xz"); var compression = new xz.Compressor(9); var inFile = fs.createReadStream("./testdata/minecraft.png"); var outFile = fs.createWriteStream("./testdata/minecraft.png.lzma2"); inFile.pipe(compression).pipe(outFile); ``` License ------- Apache 2 (open-source) license, included in 'LICENSE.txt'. Authors ------- - @robey - Robey Pointer