Skip to main content
default.duplexPair - node__stream.d.ts - Node documentation
function default.duplexPair

Usage in Deno

```typescript import mod from "node:node__stream.d.ts"; ```
duplexPair(options?: DuplexOptions): [Duplex, Duplex]
The utility function `duplexPair` returns an Array with two items, each being a `Duplex` stream connected to the other side: ```js const [ sideA, sideB ] = duplexPair(); ``` Whatever is written to one stream is made readable on the other. It provides behavior analogous to a network connection, where the data written by the client becomes readable by the server, and vice-versa. The Duplex streams are symmetrical; one or the other may be used without any difference in behavior.

Parameters

optional
options: DuplexOptions
A value to pass to both [Duplex](../.././node__stream.d.ts/~/default.Duplex) constructors, to set options such as buffering.

Return Type