node package manager

snappystream

snappystream

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

Greenkeeper badge Build Status

NPM

Usage: SnappyStream and UnsnappyStream are Transform streams.

const {SnappyStream} = require('snappystream')
const fs = require('fs')
 
const inStream = fs.createReadStream('snappy.txt')
const snappyStream = new SnappyStream()
const outStream = fs.createWriteStream('snappy_frame.txt')
 
inStream.pipe(snappyStream).pipe(outStream)

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

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