# pipe-channels

> Node channels negotiation

Latest version **0.1.1** (published 2015-11-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install pipe-channels
pnpm add pipe-channels
yarn add pipe-channels
bun add pipe-channels
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-11-23 |
| First published | 2015-11-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | pgte |
| Maintainers | pgte |
| Keywords | channel, negotiation, stream, mux, demux |

## Links

- npm: https://www.npmjs.com/package/pipe-channels
- Repository: https://github.com/pgte/pipe-channels
- Homepage: https://github.com/pgte/pipe-channels#readme
- Issues: https://github.com/pgte/pipe-channels/issues
- npm.io page: https://npm.io/package/pipe-channels

## Dependencies (4)

- [cuid](https://npm.io/package/cuid.md) ^1.3.8
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [istanbul](https://npm.io/package/istanbul.md) ^0.4.0
- [mux-demux](https://npm.io/package/mux-demux.md) ^3.7.9

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2015-11-23
- 0.1.0 — 2015-11-23

## README

# pipe-channels

[![By](https://img.shields.io/badge/made%20by-yld!-32bbee.svg?style=flat)](http://yld.io/contact?source=github-pipe-channels)
[![Build Status](https://secure.travis-ci.org/pgte/pipe-channels.svg?branch=master)](http://travis-ci.org/pgte/pipe-channels?branch=master)

Channels as streams inside a stream, negotiated.

## Install

```
$ npm install pipe-channels --save
```

## Server

```js
var Channels = require('pipe-channels');

var server = Channels.createServer();

// listen for new channel requests:

server.on('request', function(request) {

  // request.payload has arbitrary values passed in by client
  if (request.payload.token == 'this is a token') {
    var channel = request.grant(); // channel is an object stream
  } else {
    request.deny('just because'); // deny the channel
  }
});

// pipe server into duplex stream
stream.pipe(server).pipe(stream);
```


## Client

```js
var client = require('pipe-channels').createClient();

var payload = { token: 'this is a token'};

// ask for a channel, passing in any arbitrary payload:

client.channel(payload, function(err, channel) {
  if (err) {
    console.error('could not get a channel because', err.message);
  } else {
    // now I have a channel, an object stream that I can pipe
    stream.pipe(channel).pipe(stream);
  }
});
```


## License

ISC

---
_Source: https://npm.io/package/pipe-channels · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
