Skip to content

Commit 54b2d81

Browse files
committed
stream: writableComplete
1 parent 1592d0a commit 54b2d81

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/_stream_writable.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,18 @@ Object.defineProperty(Writable.prototype, 'writableFinished', {
725725
}
726726
});
727727

728+
Object.defineProperty(Writable.prototype, 'writableComplete', {
729+
// Making it explicit this property is not enumerable
730+
// because otherwise some prototype manipulation in
731+
// userland will fail
732+
enumerable: false,
733+
get() {
734+
return !this._writableState ||
735+
this._writableState.ending ||
736+
this._writableState.destroyed;
737+
}
738+
});
739+
728740
Writable.prototype.destroy = destroyImpl.destroy;
729741
Writable.prototype._undestroy = destroyImpl.undestroy;
730742
Writable.prototype._destroy = function(err, cb) {

0 commit comments

Comments
 (0)