https://github.com/tediousjs/native-duplexpair
Make a full duplex stream with 2 Duplex endpoints
https://github.com/tediousjs/native-duplexpair
Last synced: 5 months ago
JSON representation
Make a full duplex stream with 2 Duplex endpoints
- Host: GitHub
- URL: https://github.com/tediousjs/native-duplexpair
- Owner: tediousjs
- License: mit
- Fork: true (addaleax/duplexpair)
- Created: 2018-05-10T13:40:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-09-02T16:28:43.000Z (almost 3 years ago)
- Last Synced: 2025-09-28T02:48:31.509Z (9 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 1
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
duplexpair
==============
[](https://npmjs.org/package/native-duplexpair)
[](https://npmjs.org/package/native-duplexpair)
[](https://travis-ci.org/tediousjs/native-duplexpair?branch=master)
[](https://coveralls.io/r/tediousjs/native-duplexpair?branch=master)
[](https://david-dm.org/tediousjs/native-duplexpair)
Make a full duplex stream with 2 Duplex endpoints.
**Note:**
This is a fork of `duplexpair`, changed to use the "native" `Duplex` stream that is part
of Node.JS instead of the version from the `readable-stream` package.
Install:
`npm install native-duplexpair`
```js
const DuplexPair = require('native-duplexpair');
const { socket1, socket2 } = new DuplexPair();
socket1.write('Hi');
console.log(socket2.read()); // =>
// Or, using options that are passed to the Duplex constructor:
const { socket1, socket2 } = new DuplexPair({ encoding: 'utf8' });
socket1.write('Hi');
console.log(socket2.read()); // => 'Hi'
```
License
=======
MIT