From 1a8bf8a934fd7159fdb4a8adf79ef5b4098d8df7 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Mon, 17 Jul 2017 10:02:02 +0200 Subject: [PATCH] doc,stream: _transform happens one at a time Add a note to the stream docs specifying that at most a single call to _transform can happen, and the provided callback() should be used to process another chunk. Fixes: https://github.com/nodejs/node/issues/3208 PR-URL: https://github.com/nodejs/node/pull/14321 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- doc/api/stream.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index bd7c4da6208cfd..2a49b4b34f9fb1 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1920,6 +1920,10 @@ The `transform._transform()` method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs. +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asychronously. + #### Class: stream.PassThrough The `stream.PassThrough` class is a trivial implementation of a [Transform][]