Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
ronag committed Aug 3, 2021
commit 13123c46cb91e7e8aaa9d6210409bcaffe13f661
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ added: REPLACEME

* {boolean}

Returns whether the stream was destroyed before `'end'` has been emitted.
Returns whether the stream was destroyed or errored before emitting `'end'`.

##### `readable.readableDidRead`
<!-- YAML
Expand Down
12 changes: 3 additions & 9 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ function ReadableState(options, stream, isDuplex) {

this.dataEmitted = false;

this.aborted = false;

this.decoder = null;
this.encoding = null;
if (options && options.encoding) {
Expand Down Expand Up @@ -217,12 +215,7 @@ function Readable(options) {
});
}

Readable.prototype.destroy = function(err) {
if (!this._readableState.endEmitted) {
this._readableState.aborted = true;
}
destroyImpl.destroy.call(this, err);
};
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
cb(err);
Expand Down Expand Up @@ -1199,7 +1192,8 @@ ObjectDefineProperties(Readable.prototype, {
readableAborted: {
enumerable: false,
get: function() {
return this._readableState.aborted;
return (this._readableState.destroyed || this._readableState.errored) &&
!this._readableState.endEmitted;
}
},

Expand Down