You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent behavior with readable stream event "readable" in different versions of Node #31464
$ nvm use 12.14.1
Now using node v12.14.1 (npm v6.13.4)
$ node index
data { foo: 'bar' }
data null
$ nvm use 10.18.1
Now using node v10.18.1 (npm v6.13.4)
$ node index
data { foo: 'bar' }
$ nvm use 8
Now using node v8.11.3 (npm v5.6.0)
$ node index
data { foo: 'bar' } object
data null
It looks like in Node 10, there is only one readable event emitted when the stream is ended with data, whereas in Node versions 8 and 12, there is one readable emitted for the new data, and one with null to mark the end of the stream.
Is Node 10 also supposed to be emitting null as well when the stream closes?
As far as I can see readable should always be emitted when a Readable is ended (push(null)). The code is pretty explicit about it. I'm not exactly sure why this is the case but I don't see any harm in it.
Activity
ronag commentedon Jan 23, 2020
As far as I can see
readableshould always be emitted when aReadableis ended (push(null)). The code is pretty explicit about it. I'm not exactly sure why this is the case but I don't see any harm in it.Related:
targos commentedon Dec 26, 2020
Closing because there was no follow-up.