Skip to content
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: internal vs external API and streamlike compat #29006

Closed
6 of 8 tasks
ronag opened this issue Aug 6, 2019 · 5 comments
Closed
6 of 8 tasks

stream: internal vs external API and streamlike compat #29006

ronag opened this issue Aug 6, 2019 · 5 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@ronag
Copy link
Member

ronag commented Aug 6, 2019

Try to avoid using internal stream state. Make properties that are used externally part of stream public API. Also improve combat with streamlike objects.

@ronag ronag changed the title stream: internal vs external API stream: internal vs external API and streamlike compat Aug 6, 2019
@ronag
Copy link
Member Author

ronag commented Aug 6, 2019

@mcollina are you +1 on exposing writableCorked. Would be useful in user land for scenarios like:

if (!writable.writableCorked) {
  // Don't install nextTick if we are already corked. 
  writable.cork()
  process.nextTick(() => {
    writable.uncork()
  })
}

@mcollina
Copy link
Member

mcollina commented Aug 6, 2019

The cork() API is designed so you can avoid that pattern, as cork() can be called multiple times. However, I’m +1 on adding this API.

@ronag
Copy link
Member Author

ronag commented Aug 6, 2019

The cork() API is designed so you can avoid that pattern, as cork() can be called multiple times.

It's more about avoiding creating unnecessary nextTick. We have this exact case in OutgoingMessage where we use a kIsCorked symbol to achieve the same thing.

@mcollina
Copy link
Member

mcollina commented Aug 6, 2019 via email

@Fishrock123 Fishrock123 added the stream Issues and PRs related to the stream subsystem. label Aug 7, 2019
@ronag
Copy link
Member Author

ronag commented Dec 13, 2019

this is pretty much done

@ronag ronag closed this as completed Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants