floodgate
Throttles a stream to pass one value per given interval.
Last updated 7 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install floodgate 
SYNC missed versions from official npm registry.

floodgate build status

Throttles a stream to pass one value per given interval.

var floodgate = require('floodgate');

var gate = floodgate({ interval: 200 });
gate.pipe(process.stdout);

'hello world'.split('').forEach(gate.write.bind(gate));

demo

Installation

npm install floodgate

API

floodgate(opts)

/**
 * Creates a transform stream that will delay passing values through according to the given interval.
 *
 * Note:
 *  Passing and interval of 0 is useful in order to keep any streams in your pipe chain from blocking the 
 *  event loop.
 * 
 * @name Floodgate
 * @function
 * @param opts {Object} typical TransformStream options (like highWaterMark) and one additional:
 *  - interval: the interval at which to time out passing through values
 * @return {TransformStream} stream that can be added to a pipe in order to delay values coming through
 */

Similar modules

  • throttle passes data through at n bytes per second

License

MIT

Current Tags

  • 0.1.2                                ...           latest (7 years ago)

3 Versions

  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |