native-duplexpair
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/native-duplexpair package

1.0.0 • Public • Published

duplexpair

NPM Version NPM Downloads Build Status Coverage Status Dependency Status

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

const DuplexPair = require('native-duplexpair');
 
const { socket1, socket2 } = new DuplexPair();
 
socket1.write('Hi');
console.log(socket2.read());  // => <Buffer 48 69>
 
// 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

Package Sidebar

Install

npm i native-duplexpair

Weekly Downloads

1,318,076

Version

1.0.0

License

MIT

Unpacked Size

8.29 kB

Total Files

8

Last publish

Collaborators

  • arthurschreiber