pull-awaitable
Version:
Convert a pull-stream to an Async Iterable
30 lines (21 loc) • 590 B
Markdown
> Converts a pull-stream to an Async Iterable, usable with for-await-of
```bash
npm install --save pull-awaitable
```
**NOTE!** AsyncIterables and `for-await-of` are only supported in in Node.js v10, Firefox 57+, and Chrome 66.
```js
const pull = require('pull-stream')
const awaitable = require('pull-awaitable')
async function main() {
const stream = pull.values(['a', 'b']);
for await (const x of awaitable(stream)) {
console.log(x); // 'a'
// 'b'
}
}
main()
```
[](https://tldrlegal.com/license/mit-license)