From 5579c69e4706ed34acf5e1d8432b5a8147661748 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 780cecd3e45912..8dc9a1a7257587 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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) {