# stream-statistics

> stream-interface online statistics

Latest version **0.4.0** (published 2014-04-06) · 0 weekly downloads

## Install

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

Provides the command `sstatistics`.

## 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.4.0 |
| Published | 2014-04-06 |
| First published | 2012-06-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom MacWright |
| Maintainers | tmcw |

## Links

- npm: https://www.npmjs.com/package/stream-statistics
- Homepage: http://macwright.org/
- npm.io page: https://npm.io/package/stream-statistics

## Dependencies (1)

- [through2](https://npm.io/package/through2.md) ~0.4.1

## Recent versions

- 0.4.0 (latest) — 2014-04-06
- 0.3.0 — 2014-04-04
- 0.2.0 — 2014-04-03
- 0.0.1 — 2012-07-07
- 0.0.0 — 2012-06-27

## README

[![Build Status](https://travis-ci.org/tmcw/stream-statistics.svg?branch=v0.1.0)](https://travis-ci.org/tmcw/stream-statistics)

![](https://farm9.staticflickr.com/8282/7711892138_6a4c08cd71_b.jpg)

## stream-statistics

### Install

    npm install stream-statistics

### API

This module exposes a single function that creates a stream. The stream
reads data, which it parses with `parseFloat()`, and computes statistics
on that data. When the input stream ends, `stream-statistics` emits the
`data` object.

The statistics object has the following members:

* `min`
* `max`
* `sum`
* `mean`
* `mode`
* `variance`
* `standard_deviation`
* `geometric_mean`
* `harmonic_mean`

`mode` computation expects the stream to deliver numbers in sorted lowest-first
order, and will return `undefined` if that expectation is not met.

### Use

```javascript
var streamStatistics = require('stream-statistics'),
    assert = require('assert');

function rangeStream(a, b) {
    var rs = new Readable({ objectMode: true });
    for (var i = 10; i < 1000; i++) { rs.push(i); }
    rs.push(null);
    return rs;
}

rangeStream(10, 1000).pipe(streamStatistics())
    .on('data', function(d) {
        assert.equal(d.min, 10);
    });
```

## cli

This also provides a binary, `sstatistics`, that you can get if you
`npm install -g` the library. Pipe numbers into it and it'll return
a basic set of stats about its input.

![](https://github.com/tmcw/stream-statistics/blob/master/screenshot.png?raw=true)

## [Documentation](https://github.com/tmcw/stream-statistics/wiki)

## See Also

* The sister project, [simple-statistics](https://github.com/tmcw/simple-statistics), that implements
  many of the same measures in straightforward and literate fashion

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