Read
nbytes from the end of a stream
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'))
}))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.
npm install tail-bytes-stream