Skip to content

Instantly share code, notes, and snippets.

View timotheeg's full-sized avatar

Timothee Groleau timotheeg

  • Open Government Products
  • Singapore
  • 01:39 (UTC +08:00)
View GitHub Profile
@4poc
4poc / LimitStream.js
Created December 10, 2011 03:41
Node.js: LimitStream (Bandwidth limited Readable+Writable Stream)
var fs = require('fs'),
util = require('util'),
Stream = require('stream').Stream;
/**
* Create a bandwidth limited stream
*
* This is a read+writeable stream that can limit how fast it
* is written onto by emitting pause and resume events to
* maintain a specified bandwidth limit, that limit can