summaryrefslogtreecommitdiff
path: root/lib/_stream_duplex.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_stream_duplex.js')
-rw-r--r--lib/_stream_duplex.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
index d20877e921..b96a0439f7 100644
--- a/lib/_stream_duplex.js
+++ b/lib/_stream_duplex.js
@@ -74,7 +74,7 @@ Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
// userland will fail
enumerable: false,
get() {
- return this._writableState.highWaterMark;
+ return this._writableState && this._writableState.highWaterMark;
}
});
@@ -94,7 +94,7 @@ Object.defineProperty(Duplex.prototype, 'writableLength', {
// userland will fail
enumerable: false,
get() {
- return this._writableState.length;
+ return this._writableState && this._writableState.length;
}
});
@@ -104,7 +104,17 @@ Object.defineProperty(Duplex.prototype, 'writableFinished', {
// userland will fail
enumerable: false,
get() {
- return this._writableState.finished;
+ return this._writableState ? this._writableState.finished : false;
+ }
+});
+
+Object.defineProperty(Duplex.prototype, 'writableEnded', {
+ // 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.ending : false;
}
});