1.0.1 • Published 8 years ago
tail-bytes-stream v1.0.1
tail-bytes-stream
Read
nbytes from the end of a stream
Usage
var tailBytes = require('tail-bytes-stream')
dataStream.pipe(tailBytes(32, function (bytes, done) {
if(Buffer.compare(bytes, Buffer.from('...')) === 0) return done()
return done(new Error('Mismatch'))
}))API
var stream = tailBytes(n, ontail)
Read n bytes from the end of the stream and call ontail(bytes, done) when
they're available. bytes might be shorter than n if the source stream wasn't
long enough. You can rewrite bytes or other data to any subsequent streams.
Returns a Transform stream so you can pipe it to other streams.
Install
npm install tail-bytes-streamLicense
1.0.1
8 years ago