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

const [ sideA, sideB ] = duplexPair(); #1325

Open
Johnson1s opened this issue Sep 6, 2024 · 2 comments
Open

const [ sideA, sideB ] = duplexPair(); #1325

Johnson1s opened this issue Sep 6, 2024 · 2 comments

Comments

@Johnson1s
Copy link

What is the issue with the Streams Standard?

const [ sideA, sideB ] = duplexPair();

@ricea
Copy link
Collaborator

ricea commented Sep 9, 2024

Could you elaborate? I cannot identify any action I can take based on the information you have provided.

@jasnell
Copy link

jasnell commented Sep 9, 2024

If I had to guess I'd say the ask for a convenience API the essentially implements:

function duplexPair() {
  const {
    readable : r1,
    writable: w1,
  } = new TransformStream();
  const {
    readable: r2,
    writable: w2,
  } = new TransformStream();
  return [
    { readable: r1, writable: w2 },
    { readable: r2, writable: w1 },
  ];
}

But with some additional lifecycle handling that ensures half-open is optionally handled and error state is propagated across the two halves?

Similar to Node.js' equivalent API: https://nodejs.org/docs/latest/api/stream.html#streamduplexpairoptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants