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 <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
simoneb authored and mmarchini committed Jun 10, 2021
1 parent 52f8471 commit cf609cc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,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 cf609cc

Please sign in to comment.