@rbbn/distant-pull-vchannel

1.2.0 • Public • Published

pull-vchannel

Create a pull-stream from a vchannel.

Usage

Install using npm:

npm install @distant/pull-vchannel

or yarn:

yarn add @distant/pull-vchannel

Use the package like so:

import { pull, drain, values } from 'pull-stream'
import { createPullChannel } from '@distant/pull-vchannel'

const channel = getChannel()

const done = (err) => {
  if (err) {
    return console.error("There was an error that closed the channel", err)
  }

  console.log("The channel closed normally")
}

const pullChannel = createPullChannel(channel, done)

pull(
  pullChannel,
  drain(
    (message) => console.log("We got a message", message),
    (err) => console.log("The stream closed", err)
  )
)

pull(
  values(["foo", "bar", "xyzzy"]),
  pullChannel
)

Readme

Keywords

none

Package Sidebar

Install

npm i @rbbn/distant-pull-vchannel

Weekly Downloads

109

Version

1.2.0

License

SEE LICENSE IN LICENSE.md

Unpacked Size

6.49 kB

Total Files

5

Last publish

Collaborators

  • rbbn-webrtc-distant