Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: error event is optionally emitted after .destroy() #26589

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
20 changes: 11 additions & 9 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,10 @@ added: v8.0.0
* `error` {Error} Optional, an error to emit with `'error'` event.
* Returns: {this}

Destroy the stream. Optionally emit an `'error'` event, and always emit
a `'close'` event.
After this call, the writable stream has ended and subsequent calls
to `write()` or `end()` will result in an `ERR_STREAM_DESTROYED` error.
Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`
event unless `emitClose` is set in `false`. After this call, the writable
stream has ended and subsequent calls to `write()` or `end()` will result in
an `ERR_STREAM_DESTROYED` error.
This is a destructive and immediate way to destroy a stream. Previous calls to
`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.
Use `end()` instead of destroy if data should flush before close, or wait for
Expand Down Expand Up @@ -876,9 +876,10 @@ added: v8.0.0
* `error` {Error} Error which will be passed as payload in `'error'` event
* Returns: {this}

Destroy the stream, and emit `'error'` and `'close'`. After this call, the
readable stream will release any internal resources and subsequent calls
to `push()` will be ignored.
Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`
event unless `emitClose` is set in `false`. After this call, the readable
stream will release any internal resources and subsequent calls to `push()`
will be ignored.
Implementors should not override this method, but instead implement
[`readable._destroy()`][readable-_destroy].

Expand Down Expand Up @@ -1342,11 +1343,12 @@ added: v8.0.0
-->
* `error` {Error}

Destroy the stream, and emit `'error'`. After this call, the
Destroy the stream, and optionally emit an `'error'` event. After this call, the
transform stream would release any internal resources.
Implementors should not override this method, but instead implement
[`readable._destroy()`][readable-_destroy].
The default implementation of `_destroy()` for `Transform` also emit `'close'`.
The default implementation of `_destroy()` for `Transform` also emit `'close'`
unless `emitClose` is set in false.

### stream.finished(stream[, options], callback)
<!-- YAML
Expand Down