From caeb4e88874a84ba1d87cd86e010a98d5b251e2f Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sun, 23 Aug 2020 12:15:38 +0300 Subject: [PATCH] stream: fix Readable stream state properties Looks like they have been accidentally moved in https://github.com/nodejs/node/pull/31144. This also adds the proxy properties to Readable since they have been present all this time and removing them would be breaking. --- lib/_stream_readable.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 18af26d1e9f719..6482bfe328dd35 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -1215,6 +1215,22 @@ ObjectDefineProperties(Readable.prototype, { } }, + pipesCount: { + enumerable: false, + get() { + return this._readableState ? this._readableState.pipesCount : 0; + } + }, + + paused: { + enumerable: false, + get() { + return this._readableState ? this._readableState.paused : false; + } + } +}); + +ObjectDefineProperties(ReadableState.prototype, { // Legacy getter for `pipesCount` pipesCount: { get() {