Function
streamToStdin
(
stream: AsyncIterable<unknown>,
stdin: NodeJS.WritableStream,
abort?: AbortSignal
)
Source from the content-addressed store, hash-verified
| 109 | * Stream async messages to stdin |
| 110 | */ |
| 111 | export async function streamToStdin( |
| 112 | stream: AsyncIterable<unknown>, |
| 113 | stdin: NodeJS.WritableStream, |
| 114 | abort?: AbortSignal |
| 115 | ): Promise<void> { |
| 116 | for await (const message of stream) { |
| 117 | if (abort?.aborted) break |
| 118 | stdin.write(JSON.stringify(message) + '\n') |
| 119 | } |
| 120 | stdin.end() |
| 121 | } |
Tested by
no test coverage detected