MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / iterLines

Method iterLines

packages/baseai/src/dev/utils/stream/stream.ts:107–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105 let consumed = false;
106
107 async function* iterLines(): AsyncGenerator<string, void, unknown> {
108 const lineDecoder = new LineDecoder();
109
110 const iter = readableStreamAsyncIterable<Bytes>(readableStream);
111 for await (const chunk of iter) {
112 for (const line of lineDecoder.decode(chunk)) {
113 yield line;
114 }
115 }
116
117 for (const line of lineDecoder.flush()) {
118 yield line;
119 }
120 }
121
122 async function* iterator(): AsyncIterator<Item, any, undefined> {
123 if (consumed) {

Callers

nothing calls this directly

Calls 3

decodeMethod · 0.95
flushMethod · 0.95

Tested by

no test coverage detected