1.0.1 • Published 5 years ago

heartbeat-stream v1.0.1

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
5 years ago

HeartBeat Stream

HeartBeat stream will slow down chunks when number of them is below bufferSize.

constructor (inherits from Duplex) takes object with following options:

  • bufferSize - threshold of items
  • delay - each element below will be emitted with every delay milliseconds

Usage

const readableStream = /*...*/
const writeStream = /*...*/
const heartBeatStream = new HeartBeatStream({ bufferSize: 1000, delay: 1000 })

readableStream
    .pipe(heartBeatStream)
    .pipe(writeStream)

Build Status

Build Status