From 63e3a6221c4f1ebfabf2d423987c6e36c97d4dac Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 13 Nov 2019 17:03:58 +0000 Subject: [PATCH] stream: add writableCorked to Duplex PR-URL: https://github.com/nodejs/node/pull/29053 Reviewed-By: Anna Henningsen --- lib/_stream_duplex.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 27686b1490f4e5..858dc938f01cd1 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -108,6 +108,16 @@ Object.defineProperty(Duplex.prototype, 'writableFinished', { } }); +Object.defineProperty(Duplex.prototype, 'writableCorked', { + // Making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get() { + return this._writableState ? this._writableState.corked : 0; + } +}); + Object.defineProperty(Duplex.prototype, 'writableEnded', { // Making it explicit this property is not enumerable // because otherwise some prototype manipulation in