# pond

> Collect a stream into a buffer.

Latest version **2.1.2** (published 2021-11-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install pond
pnpm add pond
yarn add pond
bun add pond
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2021-11-11 |
| First published | 2014-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 1 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | XiNGRZ |
| Maintainers | xingrz |
| Keywords | stream, buffer |

## Links

- npm: https://www.npmjs.com/package/pond
- Repository: https://github.com/xingrz/pond
- Issues: https://github.com/xingrz/pond/issues
- npm.io page: https://npm.io/package/pond

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^3.2.7

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2021-11-11
- 2.1.1 — 2021-11-11
- 2.1.0 — 2021-11-02
- 2.0.1 — 2021-07-06
- 2.0.0 — 2021-07-06
- 1.0.2 — 2018-01-15
- 1.0.1 — 2018-01-15
- 1.0.0 — 2017-09-25
- 0.2.0 — 2017-01-30
- 0.1.2 — 2015-01-13
- 0.1.1 — 2014-11-20
- 0.1.0 — 2014-01-22

## README

pond [![CI](https://github.com/xingrz/pond/actions/workflows/ci.yml/badge.svg)](https://github.com/xingrz/pond/actions/workflows/ci.yml)
====

[![][coveralls-img]][coveralls-url] [![][npm-version]][npm-url] [![][npm-downloads]][npm-url] [![][license-img]][license-url] [![][issues-img]][issues-url] [![commits][commits-img]][commits-url]

Collect a stream into a buffer.

Please aware that, because buffers came out from a stream are buffered into the memory, **DO NOT try to collect a stream that is large or with unknowable length!**

```js
import { createReadStream } from 'fs';
import { createHash } from 'crypto';
import pond from 'pond';

const digest = await createReadStream('/path/to/some/file')
  .pipe(createHash('sha256'))
  .pipe(pond())
  .spoon();

console.log(digest.toString('hex'));
```


## Requirements

Node >= 10, tested on latest Node and latest LTS Node.


## Installation

```sh
npm install --save pond
```


## Usage

### Promise, await

```js
const buffer = await stream.pipe(pond()).spoon();
```

```js
const buffer = await pond(stream).spoon();
```

### Stream API (piping):

```js
fs.createReadStream('somefile')
  .pipe(pond())
  .on('error', (err) => {
    // ...
  })
  .spoon((buffer) => {
    // ...
  });
```

### Or, old-fashioned callback:

```js
pond(fs.createReadStream('anotherfile'), function (err, buffer) {
  // ...
});
```


## Test

```sh
npm test
```


## License

This project is released under the terms of [MIT License](LICENSE).


[coveralls-img]: https://img.shields.io/coveralls/xingrz/pond/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/xingrz/pond
[npm-version]: https://img.shields.io/npm/v/pond.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/pond.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/pond
[license-img]: https://img.shields.io/npm/l/pond.svg?style=flat-square
[license-url]: LICENSE
[issues-img]:	https://img.shields.io/github/issues/xingrz/pond.svg?style=flat-square
[issues-url]: https://github.com/xingrz/pond/issues
[commits-img]: https://img.shields.io/github/last-commit/xingrz/pond?style=flat-square
[commits-url]: https://github.com/xingrz/pond/commits/master

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