MCPcopy Create free account
hub / github.com/github/gh-aw / lineIterator

Function lineIterator

actions/setup/js/apply_samples.cjs:452–468  ·  view source on GitHub ↗

* Turn the MCP server's stdout into an async iterator of line strings. * @param {NodeJS.ReadableStream} stdout

(stdout)

Source from the content-addressed store, hash-verified

450 * @param {NodeJS.ReadableStream} stdout
451 */
452async function* lineIterator(stdout) {
453 let buffer = "";
454 for await (const chunk of stdout) {
455 buffer += chunk.toString();
456 let newlineIdx;
457 while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
458 const line = buffer.slice(0, newlineIdx).trim();
459 buffer = buffer.slice(newlineIdx + 1);
460 if (line) {
461 yield line;
462 }
463 }
464 }
465 if (buffer.trim()) {
466 yield buffer.trim();
467 }
468}
469
470/**
471 * Locate the safe_outputs_mcp_server.cjs script. The setup action copies it

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected