Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stream: rollback duplex from new api
  • Loading branch information
ErickWendel committed Jan 13, 2023
commit 47ca37d4a76b9153569ed57172e20c772444fb4e
5 changes: 2 additions & 3 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Readable.ReadableState = ReadableState;
const EE = require('events');
const { Stream, prependListener } = require('internal/streams/legacy');
const { Buffer } = require('buffer');
const Duplex = require('internal/streams/duplex');

const {
addAbortSignal,
Expand Down Expand Up @@ -88,7 +87,7 @@ function ReadableState(options, stream, isDuplex) {
// values for the readable and the writable sides of the duplex stream.
// These options can be provided separately as readableXXX and writableXXX.
if (typeof isDuplex !== 'boolean')
isDuplex = stream instanceof Duplex;
isDuplex = stream instanceof Stream.Duplex;

// Object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away.
Expand Down Expand Up @@ -190,7 +189,7 @@ function Readable(options) {

// Checking for a Stream.Duplex instance is faster here instead of inside
// the ReadableState constructor, at least with V8 6.5.
const isDuplex = this instanceof Duplex;
const isDuplex = this instanceof Stream.Duplex;

this._readableState = new ReadableState(options, this, isDuplex);

Expand Down
5 changes: 2 additions & 3 deletions lib/internal/streams/writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Writable.WritableState = WritableState;

const EE = require('events');
const Stream = require('internal/streams/legacy').Stream;
const Duplex = require('internal/streams/duplex');
const { Buffer } = require('buffer');
const destroyImpl = require('internal/streams/destroy');

Expand Down Expand Up @@ -82,7 +81,7 @@ function WritableState(options, stream, isDuplex) {
// values for the readable and the writable sides of the duplex stream,
// e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
if (typeof isDuplex !== 'boolean')
isDuplex = stream instanceof Duplex;
isDuplex = stream instanceof Stream.Duplex;

// Object stream flag to indicate whether or not this stream
// contains buffers or objects.
Expand Down Expand Up @@ -229,7 +228,7 @@ function Writable(options) {

// Checking for a Stream.Duplex instance is faster here instead of inside
// the WritableState constructor, at least with V8 6.5.
const isDuplex = (this instanceof Duplex);
const isDuplex = (this instanceof Stream.Duplex);

if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this))
return new Writable(options);
Expand Down