MCPcopy
hub / github.com/wavetermdev/waveterm / StreamToLines

Function StreamToLines

tsunami/util/streamtolines.go:59–69  ·  view source on GitHub ↗
(input io.Reader, lineFn func([]byte))

Source from the content-addressed store, hash-verified

57}
58
59func StreamToLines(input io.Reader, lineFn func([]byte)) error {
60 var lineBuf lineBuf
61 readBuf := make([]byte, 64*1024)
62 for {
63 n, err := input.Read(readBuf)
64 streamToLines_processBuf(&lineBuf, readBuf[:n], lineFn)
65 if err != nil {
66 return err
67 }
68 }
69}
70
71// starts a goroutine to drive the channel
72// line output does not include the trailing newline

Callers 1

StreamToLinesChanFunction · 0.70

Calls 2

streamToLines_processBufFunction · 0.70
ReadMethod · 0.45

Tested by

no test coverage detected