0.0.4 • Published 12 years ago

streambrake v0.0.4

Weekly downloads
3
License
-
Repository
github
Last release
12 years ago

node-streambrake

A Node.js stream you can insert into a stream pipe to limit its throughput. Throughput is measured by overlapping sliding windows and buffered it the limit is exceeded. Also backpressure is used to throttle the writer.

Install

npm install streambrake

Usage

var StreamBrake = require('streambrake'),
    fs = require('fs');

fs.createReadStream('/dev/random')
    .pipe(new StreamBrake(128000))
    .pipe(fs.createWriteStream('slowRandom'));

API

constructor(bytesPerSecond, measurementsPerSecond)

Creates a readable and writable stream which will emit no more than bytesPerSecond bytes per second.

measurementsPerSecond is an optional value of how often per second to measure throughput and emit queued data. Default is 5.

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago

0.0.0

12 years ago