Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-iterator-to-pull-stream

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-iterator-to-pull-stream

Convert a (async) iterator to a pull stream

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
576
decreased by-20.88%
Maintainers
1
Weekly downloads
 
Created
Source

async-iterator-to-pull-stream

Build Status dependencies Status

Convert a (async) iterator to a pull stream

Install

npm install async-iterator-to-pull-stream

Usage

const pull = require('pull-stream')
const toPull = require('async-iterator-to-pull-stream')

const iterator = async function * () {
  const sourceValues = [1, 2, 3, 4, 5]
  for (let i = 0; i < sourceValues.length; i++) {
    yield await new Promise(resolve => setTimeout(() => resolve(sourceValues[i])))
  }
}

pull(
  toPull(iterator()),
  pull.collect((err, values) => {
    console.log(values) // 1, 2, 3, 4, 5
  })
)

API

toPull(iterator)

Convert an async iterator into a pull stream. Returns a pull stream that can be used as a source in a pull pipeline.

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Alan Shaw

Keywords

FAQs

Package last updated on 14 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc