From fdf9601a91fb3122167799a41baae0ddd97a20f3 Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Fri, 5 May 2017 15:57:57 +0200 Subject: [PATCH] stream: remove usage of *State.highWaterMark Replaced _readableState.highWaterMark with a .readableHighWaterMark getter and _writableState.highWaterMark with a .writableHighWaterMark getter. The getters are non-enumerable because they break some prototype manipulation that happen in the ecosystem. Ref: https://github.com/nodejs/node/issues/445. PR-URL: https://github.com/nodejs/node/pull/12860 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/stream.md | 16 +++++++++++++ lib/_http_server.js | 6 ++--- lib/_stream_duplex.js | 23 +++++++++++++++---- lib/_stream_readable.js | 9 ++++++++ lib/_stream_writable.js | 10 ++++++++ lib/fs.js | 2 +- test/parallel/test-http-pipeline-regr-3508.js | 2 +- test/parallel/test-stream-big-packet.js | 2 +- .../test-stream-readable-flow-recursion.js | 2 +- .../test-stream-transform-split-objectmode.js | 16 +++++++++---- test/parallel/test-stream2-unpipe-leak.js | 2 +- 11 files changed, 73 insertions(+), 17 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 8a60eefdbf72f8..dec38202221b70 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -437,6 +437,14 @@ process.nextTick(() => { See also: [`writable.cork()`][]. +##### writable.writableHighWaterMark + + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + ##### writable.write(chunk[, encoding][, callback]) + +Return the value of `highWaterMark` passed when constructing this +`Readable`. + ##### readable.read([size])