From 7f742aea381c3050a5d8bd0a850b812c286ac2ba Mon Sep 17 00:00:00 2001 From: Shaun Keys <mariobuddy@gmail.com> Date: Tue, 18 May 2021 13:33:32 -0600 Subject: [PATCH] doc: clarify when `readable._read(...)` is called Fixes: https://github.com/nodejs/node/issues/38586 PR-URL: https://github.com/nodejs/node/pull/38726 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> --- doc/api/stream.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 4a28170dd3338e..2a49308959a972 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2566,10 +2566,12 @@ All `Readable` stream implementations must provide an implementation of the When [`readable._read()`][] is called, if data is available from the resource, the implementation should begin pushing that data into the read queue using the -[`this.push(dataChunk)`][stream-push] method. `_read()` should continue reading -from the resource and pushing data until `readable.push()` returns `false`. Only -when `_read()` is called again after it has stopped should it resume pushing -additional data onto the queue. +[`this.push(dataChunk)`][stream-push] method. `_read()` will be called again +after each call to [`this.push(dataChunk)`][stream-push] once the stream is +ready to accept more data. `_read()` may continue reading from the resource and +pushing data until `readable.push()` returns `false`. Only when `_read()` is +called again after it has stopped should it resume pushing additional data into +the queue. Once the [`readable._read()`][] method has been called, it will not be called again until more data is pushed through the [`readable.push()`][stream-push]