heartbeat-stream
v1.0.1
Published
heartbeat stream will help to keep objects flowing when main stream is waiting for more data
Downloads
2
Maintainers
Readme
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)