node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »


Benchmark binary streams. Mostly a copy paste of benchmark/net-pipe


var streamBench = require('stream-bench')
  , http        = require('http')
  , fs          = require('fs')
http.get('', function (res) {
  var out = fs.createWriteStream('./out')
  var bench = streamBench({
    interval: 100,
    metric:   'mbytes'
  bench.on('rate', function (rate) {
    console.log('rate: ', rate)
  bench.once('report', function (report) {


All the options are passed to the underlying stream, so lowWaterMark, highWaterMark, bufferSize, etc are all valid.

  • interval: How often to calculate throughput (in ms). Default 1000
  • metric: In what metric to report (bits, kbits, mbits, gbits, bytes, kbytes, mbytes, gbytes). Default mbits
  • logReport: Whether to log report to stdout. Default false
  • dump: Whether to dump data read from input stream. Useful when you won't pipe to another stream. Default false


  • tests
  • custom calculator function (eg for object streams)