tail-bytes-stream

1.0.1 • Public • Published

tail-bytes-stream

Build Status

Read n bytes 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-stream

License

ISC

Readme

Keywords

none

Package Sidebar

Install

npm i tail-bytes-stream

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • emilbayes