All Projects → staltz → Pull Awaitable

staltz / Pull Awaitable

Licence: mit
Convert a pull-stream into an AsyncIterable, and use for-await-of

Programming Languages

javascript
184084 projects - #8 most used programming language

pull-awaitable

Converts a pull-stream to an Async Iterable, usable with for-await-of

npm install --save pull-awaitable

NOTE! AsyncIterables and for-await-of are only supported in in Node.js v10, Firefox 57+, and Chrome 66.

Usage

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()

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].