xz-pipe

pipes for xz

xz-pipe

Pipes for xz

$ npm install xz-pipe

You will need to have the xz binary in your $PATH.

var xz = require("xz-pipe");
var fs = require("fs");
 
var file_in = fs.createReadStream('./file.txt.xz');
var file_out = fs.createWriteStream('file.txt');
 
file_in.pipe(xz.d()).pipe(file_out);
var xz = require("xz-pipe");
var fs = require("fs");
 
var file_in = fs.createReadStream('./file.txt.xz');
 
file_in.pipe(xz.d(function(uncompressed){
    // uncompressed is a Buffer. 
    console.log(uncompressed.toString());
}));

It's in the Public Domain.