Skip to content

Commit

Permalink
stream: remove no longer necessary ComposeDuplex
Browse files Browse the repository at this point in the history
PR-URL: #40545
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
ronag authored and targos committed Nov 6, 2021
1 parent 841f35c commit bac7fe0
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions lib/internal/streams/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit bac7fe0

Please sign in to comment.