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 and ruyadorno committed Sep 16, 2023
1 parent d723e87 commit 1aa798d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/api/stream.md
Expand Up @@ -4507,7 +4507,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 1aa798d

Please sign in to comment.