Skip to content

Commit

Permalink
stream: drain Transform with 0 highWaterMark
Browse files Browse the repository at this point in the history
Fixes: #40935

PR-URL: #40947
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • Loading branch information
ronag authored and danielleadams committed Feb 1, 2022
1 parent 90ac3dc commit 3b1c012
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/internal/streams/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Transform.prototype._write = function(chunk, encoding, callback) {
wState.ended || // Backwards compat.
length === rState.length || // Backwards compat.
rState.length < rState.highWaterMark ||
rState.highWaterMark === 0 ||
rState.length === 0
) {
callback();
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-stream-passthrough-drain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';
const common = require('../common');
const { PassThrough } = require('stream');

const pt = new PassThrough({ highWaterMark: 0 });
pt.on('drain', common.mustCall());
pt.write('hello');
pt.read();

0 comments on commit 3b1c012

Please sign in to comment.