-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document highWaterMark
option of events.on()
#52078
Labels
events
Issues and PRs related to the events subsystem / EventEmitter.
feature request
Issues that request new features to be added to Node.js.
stream
Issues and PRs related to the stream subsystem.
Comments
ehmicky
added
the
feature request
Issues that request new features to be added to Node.js.
label
Mar 14, 2024
ehmicky
changed the title
Document
Document Mar 14, 2024
highWaterMark
option of stream.on()
highWaterMark
option of events.on()
atlowChemi
added
events
Issues and PRs related to the events subsystem / EventEmitter.
stream
Issues and PRs related to the stream subsystem.
labels
Mar 14, 2024
atlowChemi
added a commit
to atlowChemi/node
that referenced
this issue
Mar 14, 2024
atlowChemi
added a commit
to atlowChemi/node
that referenced
this issue
Mar 14, 2024
atlowChemi
added a commit
to atlowChemi/node
that referenced
this issue
Mar 14, 2024
atlowChemi
added a commit
to atlowChemi/node
that referenced
this issue
Mar 17, 2024
atlowChemi
added a commit
to atlowChemi/node
that referenced
this issue
Apr 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
events
Issues and PRs related to the events subsystem / EventEmitter.
feature request
Issues that request new features to be added to Node.js.
stream
Issues and PRs related to the stream subsystem.
What is the problem this feature will solve?
#41276 added the
highWaterMark
option toevents.on()
in Node 20.0.0.node/lib/events.js
Line 1067 in 1abff07
That option is quite useful when using
on(stream, 'data')
.on()
uses an internal buffer. If too many events happen at once, this buffer can potentially consume lots of memory. When thehighWaterMark
option is used, the stream is temporarily paused when this happens. Once the buffer is empty, the stream is resumed. Basically, this makeson()
stream-friendly.What is the feature you are proposing to solve the problem?
Document the
highWaterMark
option ofstream.on()
.What alternatives have you considered?
An alternative would be, if a
Readable
orDuplex
is passed toon()
, to set thehighWaterMark
option tostream.readableHighWaterMark
. This would enable the above streaming behavior by default, when a stream is used.In many cases, users will just want to enable this feature and use the same
highWaterMark
as the stream. So enabling this by default for stream might remove the need to expose the option.The text was updated successfully, but these errors were encountered: