Reputation: 3041
NodeJS documentation mentions about the flowing/non-flowing mode (in ReadableState
). The following excerpt further explains the different possible states a Readable stream can be in at a time. (https://nodejs.org/api/stream.html#stream_three_states)
Specifically, at any given point in time, every Readable is in one of three possible states:
readable._readableState.flowing = null
readable._readableState.flowing = false
readable._readableState.flowing = true
I would appreciate any references that provides more explanation. I am specifically curious about the characteristics/behavior of each state; and what actions trigger a transition between different states? Furthermore.
If I am not wrong, in flowing mode: the stream actively generates data, while in non-flowing mode: the stream doesn't generate any data until a r.read(size)
is called.
Is there any difference between non-flowing mode and paused mode? r.isPaused()
is false when _readableState.flowing == null
.
Upvotes: 2
Views: 5262
Reputation: 6377
Best bet is probably searching source/repo on github for 'flowing'.
Readable streams effectively operate in one of two modes: flowing and paused. When in flowing mode, data is read from the underlying system automatically and provided to an application as quickly as possible using events via the … explicitly to read chunks of data from the stream. All [Readable][] streams begin in paused mode but can be switched to flowing
https://github.com/nodejs/node/search?q=flowing&type=Code&utf8=%E2%9C%93
Upvotes: 2