Skip to content

Commit

Permalink
[Squash] Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Jun 28, 2021
1 parent ed2f701 commit 89c1895
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,12 @@ function newStreamReadableFromReadableStream(readableStream, options = {}) {
PromisePrototypeThen(
reader.read(),
(chunk) => {
readable.push(chunk.value);
if (chunk.done)
if (chunk.done) {
// Value should always be undefined here.
readable.push(null);
} else {
readable.push(chunk.value);
}
},
(error) => readable.destroy(error));
},
Expand Down Expand Up @@ -667,9 +670,11 @@ function newStreamDuplexFromReadableWritablePair(pair = {}, options = {}) {
PromisePrototypeThen(
reader.read(),
(chunk) => {
duplex.push(chunk.value);
if (chunk.done)
if (chunk.done) {
duplex.push(null);
} else {
duplex.push(chunk.value);
}
},
(error) => duplex.destroy(error));
},
Expand Down

0 comments on commit 89c1895

Please sign in to comment.