net: add createPipe() - #65094
Open
kingces95 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Chris King <kingces95@gmail.com>
kingces95
marked this pull request as ready for review
August 7, 2026 01:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
node:pipemodule withcreatePipe(), returning a readableand writable endpoint owned by the parent process.
The endpoints may be passed to
child_process.spawn()stdio. This letsthe parent lend a pipe endpoint to a child without turning the parent
stream itself into child-owned stdio. The parent can then reclaim unread
bytes or lend the same endpoint to a later child.
This is useful for bash-like partial consumption of long-lived streams.
For example, a parent can keep ownership of an Server Sent Event stream
while delegating bounded reads to external tools, then continue parsing
from the exact byte where the child stopped.
The central integration test writes
abc, lets child A reada, letschild B read
b, and then verifies that the parent can still readc.Endpoints created by
pipe.createPipe()are rejected byspawnSync(), andan endpoint may only be leased to one child process at a time.
Tests cover
node:pipecreation, documentation examples, child stdioleasing, sequential lease-and-reclaim behavior, lease error cleanup,
spawnSync()rejection, and platform-consistent writablefinishbehavior.