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

Function makeLineSplitter

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

Source from the content-addressed store, hash-verified

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

Callers 1

startSidecarFunction · 0.85

Calls 1

writeFunction · 0.50

Tested by

no test coverage detected