snappystream
v2.1.1
Published
Framed Snappy streams
Downloads
54,814
Maintainers
Readme
snappystream
A Node.js library for supporting the Snappy framing format via streams. See the Snappy Framing Format Description for details.
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)