Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobbubu/pull-plex
https://github.com/jacobbubu/pull-plex
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jacobbubu/pull-plex
- Owner: jacobbubu
- License: mit
- Created: 2020-04-12T11:53:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:14:52.000Z (about 2 years ago)
- Last Synced: 2025-01-02T21:12:45.325Z (25 days ago)
- Language: TypeScript
- Homepage:
- Size: 410 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# @jacobbubu/pull-plex
[![Build Status](https://github.com/jacobbubu/pull-plex/workflows/Build%20and%20Release/badge.svg)](https://github.com/jacobbubu/pull-plex/actions?query=workflow%3A%22Build+and+Release%22)
[![Coverage Status](https://coveralls.io/repos/github/jacobbubu/pull-plex/badge.svg)](https://coveralls.io/github/jacobbubu/pull-plex)
[![npm](https://img.shields.io/npm/v/@jacobbubu/pull-plex.svg)](https://www.npmjs.com/package/@jacobbubu/pull-plex/)> A multiplex solution for pull-stream.
# Usage
``` ts
import * as pull from 'pull-stream'
import { Plex, Channel } from '../src'const plex1 = new Plex('p1')
const plex2 = new Plex('p2')const a = plex1.createChannel('a')
pull(pull.values([1, 2, 3]), a.sink)
pull(
a.source,
pull.collect((_, ary) => {
console.log(`received data on channel ${a.name}/${plex1.plexName}:`, ary)
})
)plex2.on('channel', (channel: Channel) => {
pull(
channel.source,
pull.collect((_, ary) => {
console.log(`received data on channel ${channel.name}/${plex2.plexName}:`, ary)
})
)
pull(pull.values([4, 5, 6]), channel.sink)
})pull(plex1, plex2)
pull(plex2, plex1)
```