HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/linde-ai/html/node_modules/duplexer3/readme.md
# duplexer3

Like [`duplexer2`](https://github.com/deoxxa/duplexer2) but using Streams3 without readable-stream dependency

```js
var stream = require("stream");
var duplexer3 = require("duplexer3");

var writable = new stream.Writable({objectMode: true}),
		readable = new stream.Readable({objectMode: true});

writable._write = function _write(input, encoding, done) {
	if (readable.push(input)) {
		return done();
	} else {
		readable.once("drain", done);
	}
};

readable._read = function _read(n) {
	// no-op
};

// simulate the readable thing closing after a bit
writable.once("finish", function() {
	setTimeout(function() {
		readable.push(null);
	}, 500);
});

var duplex = duplexer3(writable, readable);

duplex.on("data", function(e) {
	console.log("got data", JSON.stringify(e));
});

duplex.on("finish", function() {
	console.log("got finish event");
});

duplex.on("end", function() {
	console.log("got end event");
});

duplex.write("oh, hi there", function() {
	console.log("finished writing");
});

duplex.end(function() {
	console.log("finished ending");
});
```

```
got data "oh, hi there"
finished writing
got finish event
finished ending
got end event
```

## Overview

This is a reimplementation of [duplexer](https://www.npmjs.com/package/duplexer) using the
Streams3 API which is standard in Node as of v4. Everything largely
works the same.

## Install

```sh
npm install duplexer3
```

## API

### duplexer3

Creates a new `DuplexWrapper` object, which is the actual class that implements
most of the fun stuff. All that fun stuff is hidden. DON'T LOOK.

```js
duplexer3([options], writable, readable)
```

```js
const duplex = duplexer3(new stream.Writable(), new stream.Readable());
```

Arguments

* __options__ - an object specifying the regular `stream.Duplex` options, as
	well as the properties described below.
* __writable__ - a writable stream
* __readable__ - a readable stream

Options

* __bubbleErrors__ - a boolean value that specifies whether to bubble errors
	from the underlying readable/writable streams. Default is `true`.