Skip to content

Commit

Permalink
doc: clarify transform._transform() callback argument logic
Browse files Browse the repository at this point in the history
Clarify that `transform._transform()` callback second argument is
used only if the first argument is `null`, i.e. no error occured
processing the chunk.

PR-URL: #48680
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
  • Loading branch information
rafasofizada authored Jul 8, 2023
1 parent 0fd7ca5 commit eece8d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -4517,7 +4517,8 @@ The `callback` function must be called only when the current chunk is completely
consumed. The first argument passed to the `callback` must be an `Error` object
if an error occurred while processing the input or `null` otherwise. If a second
argument is passed to the `callback`, it will be forwarded on to the
`transform.push()` method. In other words, the following are equivalent:
`transform.push()` method, but only if the first argument is falsy. In other
words, the following are equivalent:

```js
transform.prototype._transform = function(data, encoding, callback) {
Expand Down

0 comments on commit eece8d7

Please sign in to comment.