1.0.2 • Published 5 years ago

drop-stream2 v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

DropStream

Drop beginning bytes in a stream

npm install drop-stream2

Usage

const bl = require('bl')
const { drop, dropBytes, dropUntil } = require('drop-stream2')


bl('hello\nworld')
  .pipe(drop((buf) => buf.indexOf('\n'))
  .on('drop', (buf) => console.log(`${buf}`)) // hello\n
  .pipe(bl(err, buf) => console.log(`${buf}`)) // world

bl('hello\nworld')
  .pipe(dropBytes(6))
  .on('drop', (buf) => console.log(`${buf}`)) // hello\n
  .pipe(bl(err, buf) => console.log(`${buf}`)) // world

bl('hello\nworld')
  .pipe(dropUntil('\n'))
  .on('drop', (buf) => console.log(`${buf}`)) // hello\n
  .pipe(bl(err, buf) => console.log(`${buf}`)) // world