snappystream

Framed Snappy streams

snappystream

A NodeJS library for supporting the Snappy framing format via streams. See the Snappy Framing Format Description for details.

Usage: SnappyStream and UnsnappyStream are Transform streams.

var SnappyStream = require('snappystream').SnappyStream;
 
var in = fs.createReadStream('snappy.txt');
var snappyStream = new SnappyStream();
var out = fs.createWriteStream('snappy_frame.txt')
 
in.pipe(snappyStream).pipe(out);

UnsnappyStream constructor takes an optional argument verifyChecksums which is false by default.

var SnappyStream = require('snappysteam').UnsnappyStream;
 
var in = fs.createReadStream('snappy_frame.txt');
var unsnappyStream = new UnsnappyStream(true);
 
unsnappyStream.on('end', function() {
  console.log(unsnappyStream.read());
});
 
in.pipe(unsnappyStream);