# stream2asynciter

> Create async iterator from regular stream

Latest version **1.0.3** (published 2022-03-30) · ISC license · 0 weekly downloads

## Install

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

## 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 | 1.0.3 |
| Published | 2022-03-30 |
| First published | 2019-02-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dmitry Berezhnov |
| Maintainers | dmitry.berezhnov |
| Keywords | async, iterator, stream |

## Links

- npm: https://www.npmjs.com/package/stream2asynciter
- Repository: https://github.com/TimonKK/stream2asyncIter
- Homepage: https://github.com/TimonKK/stream2asyncIter#readme
- Issues: https://github.com/TimonKK/stream2asyncIter/issues
- npm.io page: https://npm.io/package/stream2asynciter

## 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

- 1.0.3 (latest) — 2022-03-30
- 1.0.2 — 2020-11-02
- 1.0.1 — 2020-07-14
- 1.0.0 — 2019-02-07

## README

# stream2asyncIter

Example code which convert nodejs's stream to async iterator:

```javascript
const stream2asynciter = require('stream2asynciter');

const asyncIterator = stream2asynciter(
    // any readable stream!
    process.stdin
);

(async () => {
    for await (const line of asyncIterator) {
        console.log('readed', line.length / 1024, 'Kb');
    }
})().then(() => {
    console.log('ok!');
    process.exit();
}, err => {
    console.log('err', err);
    process.exit();
});
```

exec

```bash
cat somefile.txt | node test.js
```

and get:

```bash
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 64 Kb
readed 3.4736328125 Kb
ok!
```

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