From 41720d78c9f006bd2a046221a944852a77760703 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