# async-iteration-buffer

> Buffering for async iterators

Latest version **0.2.1** (published 2020-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-iteration-buffer
pnpm add async-iteration-buffer
yarn add async-iteration-buffer
bun add async-iteration-buffer
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2020-09-14 |
| First published | 2018-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | zenparsing |
| Keywords | iterator, async iterator |

## Links

- npm: https://www.npmjs.com/package/async-iteration-buffer
- Repository: https://github.com/zenparsing/async-iteration-buffer
- Issues: https://github.com/zenparsing/async-iteration-buffer/issues
- npm.io page: https://npm.io/package/async-iteration-buffer

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.2.1 (latest) — 2020-09-14
- 0.2.0 — 2020-01-02
- 0.1.2 — 2018-06-28
- 0.1.1 — 2018-06-28
- 0.1.0 — 2018-06-22

## README

# async-iteration-buffer

A buffering tool for async iteration.

```js
import { AsyncIterationBuffer } from 'async-iteration-buffer';

async function main() {
  let buffer = new AsyncIterationBuffer();

  // Insert a sequence of iteration results into the buffer
  buffer.next(1);
  buffer.next(2);
  buffer.next(3);
  buffer.return();

  // Pull the values out of the buffer by iterating over it
  for await (let value of buffer) {
    console.log(value);
  }
}
```

## Install

```sh
npm install async-iteration-buffer
```

## API

### new AsyncIterationBuffer()

Creates a new buffer instance.

### buffer.next(value)

Pushes a value into the iteration buffer.

### buffer.throw(error)

Pushes an exception into the iteration buffer.

### buffer.return(value)

Pushes a `done` result into the iteration buffer.

### AsyncIterationBuffer.of(...values)

Creates a buffer pre-filled with the specified values

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