MCPcopy Create free account
hub / github.com/anus-dev/ANUS / onReadable

Function onReadable

packages/cli/src/utils/readStdin.ts:15–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13 process.stdin.setEncoding('utf8');
14
15 const onReadable = () => {
16 let chunk;
17 while ((chunk = process.stdin.read()) !== null) {
18 if (totalSize + chunk.length > MAX_STDIN_SIZE) {
19 const remainingSize = MAX_STDIN_SIZE - totalSize;
20 data += chunk.slice(0, remainingSize);
21 console.warn(
22 `Warning: stdin input truncated to ${MAX_STDIN_SIZE} bytes.`,
23 );
24 process.stdin.destroy(); // Stop reading further
25 break;
26 }
27 data += chunk;
28 totalSize += chunk.length;
29 }
30 };
31
32 const onEnd = () => {
33 cleanup();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected