throttled-stream
Stream implementation with support for throttling data to a specified number of bytes per second. Inspired by node-throttle, but implemented as a full-on stream interface so that we can have more granular control over when and how data gets sent.
Usage
var throttle = // open a normal streamvar stream = // get a throttled stream that runs at 64 KB/s or slowervar slowStream = slowStream
Methods
throttled-stream(stream, bytesPerSecond, [maxWaitTimeMs = 100])
Pipes the specified stream into a new throttled stream, allowing at most bytesPerSecond
bytes per second through. maxWaitTimeMs
allows you to specify the maximum amount of time, in milliseconds, that the stream will wait before trying to emit another data
event if it receives more data than it can allow through at once.
Installation
npm install throttled-stream
License
WTFPL