@tsjing/snappystream

Framed Snappy streams


Keywords
Snappy, Snappy framing format, Snappy stream
License
MIT
Install
npm install @tsjing/snappystream@0.3.4

Documentation

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)