-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
stream: standardize async initialization #29314
Labels
stream
Issues and PRs related to the stream subsystem.
Comments
ronag
changed the title
stream: provide a _construct end-point for streams with async initialization.
stream: standardize async initialization.
Aug 25, 2019
ronag
changed the title
stream: standardize async initialization.
stream: standardize async initialization
Aug 25, 2019
I suggest in order to land this we first update either |
Here is a proposal implementation. Don't think I can get much further without some feedback. |
ronag
added a commit
to nxtedition/node
that referenced
this issue
May 25, 2020
Provide a standardized way of asynchronously creating and initializing resources before performing any work. Refs: nodejs#29314
ronag
added a commit
that referenced
this issue
May 27, 2020
Provide a standardized way of asynchronously creating and initializing resources before performing any work. Refs: #29314 PR-URL: #29656 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
This has landed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some streams (e.g.
fs
andnet
) need to first asynchronously create resources before they can perform any work. Currently this is implemented in the different stream implementations which both makes things more difficult and error prone (e.g.'open'
and'ready'
are emitted after'close'
). I suggest we provide a standardized way of achieving this.This would allow further simplification and improved consistency for various stream implementations such as
fs
andnet
stream.I propose the following API for this:
stream._construct(cb)
endpoint (similar to_destroy(cb)
).stream.ready
property indicating whether the stream is ready (currently this is calledpending
in some implementations). IncludingreadableReady
andwritableReady
accessors.'ready'
event (currently this is called'open'
in some implementations).See, nxtedition#2 for proof of concept.
The text was updated successfully, but these errors were encountered: