Skip to content
Merged
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
applied review changes to adapters.js
  • Loading branch information
seriousme committed Jul 10, 2025
commit 7efa8d2c5ece405ed75cb38b674ff4bff22d8c55
8 changes: 6 additions & 2 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ function newReadableStreamFromStreamReadable(streamReadable, options = kEmptyObj
const highWaterMark = streamReadable.readableHighWaterMark;

const evaluateStrategyOrFallback = (strategy) => {
// If the stream is BYOB, we only use highWaterMark
if (isBYOB)
return { highWaterMark };
// If there is a strategy available, use it
if (strategy)
return strategy;
Expand Down Expand Up @@ -519,7 +522,7 @@ function newReadableStreamFromStreamReadable(streamReadable, options = kEmptyObj
wasCanceled = true;
destroy(streamReadable, reason);
},
}, isBYOB ? { highWaterMark: strategy.highWaterMark } : strategy);
}, strategy);
}

/**
Expand Down Expand Up @@ -622,6 +625,7 @@ function newStreamReadableFromReadableStream(readableStream, options = kEmptyObj
/**
* @param {Duplex} duplex
* @param {{ type?: 'bytes' }} [options]
* @returns {ReadableWritablePair}
*/
function newReadableWritablePairFromDuplex(duplex, options = kEmptyObject) {
// Not using the internal/streams/utils isWritableNodeStream and
Expand Down Expand Up @@ -656,7 +660,7 @@ function newReadableWritablePairFromDuplex(duplex, options = kEmptyObject) {
const readable =
isReadable(duplex) ?
newReadableStreamFromStreamReadable(duplex, options) :
new ReadableStream(options);
new ReadableStream({ type: options.type });

if (!isReadable(duplex))
readable.cancel();
Expand Down