# stream-bench

> Node streams benchmarking (throughput, etc)

Latest version **0.1.2** (published 2013-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-bench
pnpm add stream-bench
yarn add stream-bench
bun add stream-bench
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2013-02-12 |
| First published | 2013-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dan Milon |
| Maintainers | danmilon |
| Keywords | streams, benchmark, throughput |

## Links

- npm: https://www.npmjs.com/package/stream-bench
- Repository: git@github.com:danmilon/streams-benchmark
- npm.io page: https://npm.io/package/stream-bench

## Dependencies (1)

- [readable-stream](https://npm.io/package/readable-stream.md) 0.2.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2013-02-12
- 0.1.1 — 2013-02-12
- 0.1.0 — 2013-02-12
- 0.0.1 — 2013-02-11

## README

Benchmark binary streams. Mostly a copy paste of [benchmark/net-pipe](https://github.com/joyent/node/blob/master/benchmark/net-pipe.js)

## Usage

```javascript
var streamBench = require('stream-bench')
  , http        = require('http')
  , fs          = require('fs')

http.get('http://nodejs.org/dist/latest/node-v0.8.19.tar.gz', 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) {
    console.log(report)
  })

  res.pipe(bench).pipe(out)
})
```

### Options

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`

## TODO

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

---
_Source: https://npm.io/package/stream-bench · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
