summaryrefslogtreecommitdiff
path: root/lib/_stream_writable.js
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-08-06 13:41:12 +0200
committerAnna Henningsen <anna@addaleax.net>2019-11-05 23:26:26 +0100
commitde119131bc87cf4168c949ecbbf1c1504f96a499 (patch)
tree0c003bef5e94d8ab84bafc3862db34dc988f82d6 /lib/_stream_writable.js
parent074730081db3269fc3559598c0698a9f6b7b20c2 (diff)
downloadandroid-node-v8-de119131bc87cf4168c949ecbbf1c1504f96a499.tar.gz
android-node-v8-de119131bc87cf4168c949ecbbf1c1504f96a499.tar.bz2
android-node-v8-de119131bc87cf4168c949ecbbf1c1504f96a499.zip
stream: add writableCorked property
PR-URL: https://github.com/nodejs/node/pull/29012 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/_stream_writable.js')
-rw-r--r--lib/_stream_writable.js10
1 files changed, 10 insertions, 0 deletions
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.