From 1aa798d69f826a912a76eb0e68ae2200af3ec7df Mon Sep 17 00:00:00 2001 From: Rafael Sofi-zada Date: Sun, 9 Jul 2023 00:11:30 +0400 Subject: [PATCH] doc: clarify transform._transform() callback argument logic 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: https://github.com/nodejs/node/pull/48680 Reviewed-By: Luigi Pinca Reviewed-By: Akhil Marsonya --- doc/api/stream.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 10b302359abcfa..b698cb6cfe634a 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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) {