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
Hi all, I've been working on a tool to identify instances of events registered to the wrong object in uses of some JavaScript event-driven APIs, as part of a research project.
The tool flagged line 34 in lib/catFile.js, on the registration of the “finish” event.
The reason I believe this is indicative of an error is as follows (from looking at the nodejs stream API documentation):
This registration occurs on the stream parameter of the readStream function, which looks by the comments as if it’s designed for readable streams; and on line 93 readStream is called with stderr (a readable stream) as the stream parameter.
However, “finish” is an event for writeable streams, not readable streams.
My guess is that instead of “finish”, the code should register a listener for “end”, which is the event emitted on readable streams once there is no more data to be consumed (described in the stream end event documentation).
The text was updated successfully, but these errors were encountered:
Hi all, I've been working on a tool to identify instances of events registered to the wrong object in uses of some JavaScript event-driven APIs, as part of a research project.
The tool flagged line 34 in lib/catFile.js, on the registration of the “finish” event.
The reason I believe this is indicative of an error is as follows (from looking at the nodejs stream API documentation):
This registration occurs on the stream parameter of the readStream function, which looks by the comments as if it’s designed for readable streams; and on line 93 readStream is called with stderr (a readable stream) as the stream parameter.
However, “finish” is an event for writeable streams, not readable streams.
My guess is that instead of “finish”, the code should register a listener for “end”, which is the event emitted on readable streams once there is no more data to be consumed (described in the stream end event documentation).
The text was updated successfully, but these errors were encountered: