mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
stream: remove no longer necessary ComposeDuplex
PR-URL: https://github.com/nodejs/node/pull/40545 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
committed by
Node.js GitHub Bot
parent
9843885e93
commit
47fb8676ff
@@ -16,28 +16,6 @@ const {
|
||||
},
|
||||
} = require('internal/errors');
|
||||
|
||||
// This is needed for pre node 17.
|
||||
class ComposeDuplex extends Duplex {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
// https://github.com/nodejs/node/pull/34385
|
||||
|
||||
if (options?.readable === false) {
|
||||
this._readableState.readable = false;
|
||||
this._readableState.ended = true;
|
||||
this._readableState.endEmitted = true;
|
||||
}
|
||||
|
||||
if (options?.writable === false) {
|
||||
this._writableState.writable = false;
|
||||
this._writableState.ending = true;
|
||||
this._writableState.ended = true;
|
||||
this._writableState.finished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function compose(...streams) {
|
||||
if (streams.length === 0) {
|
||||
throw new ERR_MISSING_ARGS('streams');
|
||||
@@ -107,7 +85,7 @@ module.exports = function compose(...streams) {
|
||||
// TODO(ronag): Avoid double buffering.
|
||||
// Implement Writable/Readable/Duplex traits.
|
||||
// See, https://github.com/nodejs/node/pull/33515.
|
||||
d = new ComposeDuplex({
|
||||
d = new Duplex({
|
||||
// TODO (ronag): highWaterMark?
|
||||
writableObjectMode: !!head?.writableObjectMode,
|
||||
readableObjectMode: !!tail?.writableObjectMode,
|
||||
|
||||
Reference in New Issue
Block a user