From de119131bc87cf4168c949ecbbf1c1504f96a499 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 6 Aug 2019 13:41:12 +0200 Subject: stream: add writableCorked property PR-URL: https://github.com/nodejs/node/pull/29012 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- lib/_stream_writable.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/_stream_writable.js') diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 9b75b672cb..9b4036e476 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -385,6 +385,16 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { } }); +Object.defineProperty(Writable.prototype, 'writableCorked', { + // Making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function() { + return this._writableState ? this._writableState.corked : 0; + } +}); + // If we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. -- cgit v1.2.3