GeezerVison is showing github.com — stream: don't push null from closed promise #42694 · nodejs/node@c514751
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/adapters.js -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,6 @@ const { | 32 | 32 | const { | 33 | 33 | isDestroyed, | 34 | 34 | isReadable, | 35 | | - isReadableEnded, | 36 | 35 | isWritable, | 37 | 36 | isWritableEnded, | 38 | 37 | } = require('internal/streams/utils'); | @@ -528,8 +527,6 @@ function newStreamReadableFromReadableStream(readableStream, options = kEmptyObj | 528 | 527 | reader.closed, | 529 | 528 | () => { | 530 | 529 | closed = true; | 531 | | - if (!isReadableEnded(readable)) | 532 | | - readable.push(null); | 533 | 530 | }, | 534 | 531 | (error) => { | 535 | 532 | closed = true; | @@ -794,8 +791,6 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = | 794 | 791 | reader.closed, | 795 | 792 | () => { | 796 | 793 | readableClosed = true; | 797 | | - if (!isReadableEnded(duplex)) | 798 | | - duplex.push(null); | 799 | 794 | }, | 800 | 795 | (error) => { | 801 | 796 | writableClosed = true; | |
Collapse file Copy file name to clipboard +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +'use strict'; | | 2 | +const { mustCall } = require('../common'); | | 3 | +const { Readable, Duplex } = require('stream'); | | 4 | +const { strictEqual } = require('assert'); | | 5 | + | | 6 | +function start(controller) { | | 7 | + controller.enqueue(new Uint8Array(1)); | | 8 | + controller.close(); | | 9 | +} | | 10 | + | | 11 | +Readable.fromWeb(new ReadableStream({ start })) | | 12 | +.on('data', mustCall((d) => { | | 13 | + strictEqual(d.length, 1); | | 14 | +})) | | 15 | +.on('end', mustCall()) | | 16 | +.resume(); | | 17 | + | | 18 | +Duplex.fromWeb({ | | 19 | + readable: new ReadableStream({ start }), | | 20 | + writable: new WritableStream({ write(chunk) {} }) | | 21 | +}) | | 22 | +.on('data', mustCall((d) => { | | 23 | + strictEqual(d.length, 1); | | 24 | +})) | | 25 | +.on('end', mustCall()) | | 26 | +.resume(); |
|