drop-stream2

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i drop-stream2

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

2.9 kB

Total Files

4

Last publish

Collaborators

  • rhyzx