Skip to content

Commit

Permalink
doc: update write callback documentation
Browse files Browse the repository at this point in the history
- replace _*may or may not* be called_ with _will be called_ because the
  callback is always called
- remove _To reliably detect write errors, add a listener for the
  `'error'` event_ because the `error` event will NOT be emitted if a
  write occurs after the stream has been closed

PR-URL: #38959
Fixes: #38704
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
simoneb authored and targos committed Jun 11, 2021
1 parent 173292b commit 0bdeeda
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doc/api/stream.md
Expand Up @@ -627,9 +627,8 @@ changes:

The `writable.write()` method writes some data to the stream, and calls the
supplied `callback` once the data has been fully handled. If an error
occurs, the `callback` *may or may not* be called with the error as its
first argument. To reliably detect write errors, add a listener for the
`'error'` event. The `callback` is called asynchronously and before `'error'` is
occurs, the `callback` will be called with the error as its
first argument. The `callback` is called asynchronously and before `'error'` is
emitted.

The return value is `true` if the internal buffer is less than the
Expand Down

0 comments on commit 0bdeeda

Please sign in to comment.