MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeLineSplitter

Function makeLineSplitter

apps/desktop/src/main/sidecar.ts:59–69  ·  view source on GitHub ↗
(write: (line: string) => void)

Source from the content-addressed store, hash-verified

57
58/** Buffer chunked output into whole lines before handing them to `write`. */
59const makeLineSplitter = (write: (line: string) => void) => {
60 let buffer = "";
61 return (text: string) => {
62 buffer += text;
63 const lines = buffer.split("\n");
64 buffer = lines.pop() ?? "";
65 for (const line of lines) {
66 if (line.trim().length > 0) write(line);
67 }
68 };
69};
70
71export interface SidecarConnection {
72 readonly baseUrl: string;

Callers 1

startSidecarFunction · 0.85

Calls 1

writeFunction · 0.50

Tested by

no test coverage detected