Skip to content

Commit 86d1c0b

Browse files
ronagtargos
authored andcommitted
stream: drain Transform with 0 highWaterMark
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]>
1 parent 3bfc9f5 commit 86d1c0b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/internal/streams/transform.js

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ Transform.prototype._write = function(chunk, encoding, callback) {
196196
wState.ended || // Backwards compat.
197197
length === rState.length || // Backwards compat.
198198
rState.length < rState.highWaterMark ||
199+
rState.highWaterMark === 0 ||
199200
rState.length === 0
200201
) {
201202
callback();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
const common = require('../common');
3+
const { PassThrough } = require('stream');
4+
5+
const pt = new PassThrough({ highWaterMark: 0 });
6+
pt.on('drain', common.mustCall());
7+
pt.write('hello');
8+
pt.read();

0 commit comments

Comments
 (0)