Skip to content

Conversation

crowlKats
Copy link
Member

@crowlKats crowlKats commented Aug 28, 2025

This commit adds SubprocessReadableStream interface that are used
for ChildProcess.stdout and ChildProcess.stderr. It's an extension to
a regular ReadableStream that provides convenience methods to collect
the output and parse it with .bytes(), .arrayBuffer(), .text() and .json()
helper methods (similarly to the ones available on Response).

Closes #30323

@bartlomieju bartlomieju added this to the 2.5.0 milestone Aug 28, 2025
* Reads the stream to completion. It returns a promise that resolves with
* the result of parsing the body text as JSON.
*/
json(): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise<unknown>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be any, as that is what Response has, and when ReadableStream gets these utilities directly on it, we would get a conflict on this

@bartlomieju bartlomieju merged commit 18fe3d1 into denoland:main Sep 2, 2025
33 of 37 checks passed
json(): Promise<any>;
/**
* Reads the stream to completion. It returns a promise that resolves with
* a `USVString` (text).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this say USVString?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

add convenience methods to stdio objects in Deno.ChildProcess
4 participants