# stream-sink

> Collect all data piped to this stream when it closes

Latest version **2.2.2** (published 2018-04-17) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.2 |
| Published | 2018-04-17 |
| First published | 2013-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Florent Jaby |
| Maintainers | floby |
| Keywords | stream, sink, streams2, test, debug |

## Links

- npm: https://www.npmjs.com/package/stream-sink
- Repository: https://github.com/Floby/node-stream-sink
- Homepage: https://github.com/Floby/node-stream-sink#readme
- Issues: https://github.com/Floby/node-stream-sink/issues
- npm.io page: https://npm.io/package/stream-sink

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 2.2.2 (latest) — 2018-04-17
- 2.2.1 — 2018-03-20
- 2.2.0 — 2018-03-20
- 2.1.1 — 2018-02-22
- 2.1.0 — 2017-05-03
- 2.0.1 — 2017-05-03
- 2.0.0 — 2016-08-19
- 1.2.0 — 2013-07-15
- 1.1.1 — 2013-07-14
- 1.1.0 — 2013-04-07
- 1.0.0 — 2013-03-29

## README

[![Build Status](https://travis-ci.org/Floby/node-stream-sink.png)](https://travis-ci.org/Floby/node-stream-sink)

stream-sink
===========

> Collect all data piped to this stream when it closes

Installation
------------

    npm install --save stream-sink

Usage
-----

```javascript
const sink = require('stream-sink')
readable.pipe(sink()).then((data) => {
    // `data` is a String
})
```

Or with `objectMode: true`

```javascript
const sink = require('stream-sink')
readable.pipe(sink.object()).then((data) => {
    // `data` is an Array
})
```

You can also handle errors in the upstream

```javascript
const sink = require('stream-sink')
readable.pipe(sink({ upstreamError: true })).catch((error) => {
    // `error` is the original error
})
readable.emit('error', Error('some error'))
```

##### 

License
-------

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2018 Florent Jaby

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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