开发者社区> 镜像站> NPM> tail-bytes-stream
tail-bytes-stream
Read `n` bytes from the end of a stream
Last updated 3 years ago by emilbayes .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tail-bytes-stream 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

1 Versions

  • 1.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None