Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorPranshu Srivastava <rexagod@gmail.com>2020-03-13 01:01:10 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-30 18:15:50 +0300
commit6ade42bb3c9d825d75fa9ef4300021a0b5b6ab08 (patch)
treec157d2d8dfa39ccb862f7331cc4155bf841d89c3 /doc/api
parentc37d4ccee81084662dfb9311aa09a8d659b4f09e (diff)
doc: stream.end(cb) cb can be invoked with error
Update docs that the optional callback passed to `writable.end` can be invoked in case of an error as well. PR-URL: https://github.com/nodejs/node/pull/32238 Fixes: https://github.com/nodejs/node/issues/31220 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/stream.md8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 69be69b5516..7a54cead755 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -405,6 +405,9 @@ Is `true` after [`writable.destroy()`][writable-destroy] has been called.
<!-- YAML
added: v0.9.4
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/29747
+ description: The `callback` is invoked if 'finish' or 'error' is emitted.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/18780
description: This method now returns a reference to `writable`.
@@ -418,14 +421,15 @@ changes:
`Uint8Array`. For object mode streams, `chunk` may be any JavaScript value
other than `null`.
* `encoding` {string} The encoding if `chunk` is a string
-* `callback` {Function} Optional callback for when the stream is finished
+* `callback` {Function} Optional callback for when the stream finishes
+ or errors
* Returns: {this}
Calling the `writable.end()` method signals that no more data will be written
to the [`Writable`][]. The optional `chunk` and `encoding` arguments allow one
final additional chunk of data to be written immediately before closing the
stream. If provided, the optional `callback` function is attached as a listener
-for the [`'finish'`][] event.
+for the [`'finish'`][] and the `'error'` event.
Calling the [`stream.write()`][stream-write] method after calling
[`stream.end()`][stream-end] will raise an error.