diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index 0df8f7aa7f6f35..0061beab8435be 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -281,7 +281,9 @@ class ReadableStream { this, source, extractHighWaterMark(highWaterMark, 0)); - return; + + // eslint-disable-next-line no-constructor-return + return makeTransferable(this); } if (type !== undefined) diff --git a/test/parallel/test-webstream-byte-readable-clone.js b/test/parallel/test-webstream-byte-readable-clone.js new file mode 100644 index 00000000000000..debe25923c3382 --- /dev/null +++ b/test/parallel/test-webstream-byte-readable-clone.js @@ -0,0 +1,18 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +{ + // https://github.com/nodejs/node/issues/46296 + const stream = new ReadableStream({ + start(controller) { + controller.close(); + }, + type: 'bytes', + }); + + const clone = structuredClone(stream, { transfer: [stream] }); + + assert(clone instanceof ReadableStream); +}