1.1.2 • Published 3 years ago

stream-throttler v1.1.2

Weekly downloads
93
License
MIT
Repository
github
Last release
3 years ago

The StreamThrottler class extends Nodejs PassThrough stream. It is quite similar, however allows you to specify a bps "bytes per second" option causing data to be restricted to this rate.

Install

yarn add stream-throttler

Quick Start

import StreamThrottler from "stream-throttler";

const throttler = new StreamThrottler({ bps: 16 * 1024 * 1024 });

process.stdin.pipe(throttler).pipe(process.stdout);

API

new StreamThrottler(opts): PassthroughStream

You pass an options Object with a bps value specified. This is the desired max bytes per second.

Nodejs will automatically handle backpressure, so you can use this with any Nodejs stream.

You may also use this with a 'pipeline'.

Options:

  • bps: number, the bytes-per-second to limit the stream at.

License

MIT

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago