Stream implementation that throttles its output to a maximum number of bytes per second.

npm install throttled-stream
2 downloads in the last week
27 downloads in the last month


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.


var throttle = require('throttled-stream')

// open a normal stream
var stream = require('fs').createReadStream('./myFile')

// get a throttled stream that runs at 64 KB/s or slower
var slowStream = throttle(stream, 64*1024)

slowStream.on('data', function(chunk) {
    // ...


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.


npm install throttled-stream



npm loves you