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

Function StreamToLinesChan

pkg/util/utilfn/streamtolines.go:78–90  ·  view source on GitHub ↗

starts a goroutine to drive the channel line output does not include the trailing newline

(input io.Reader)

Source from the content-addressed store, hash-verified

76// starts a goroutine to drive the channel
77// line output does not include the trailing newline
78func StreamToLinesChan(input io.Reader) chan LineOutput {
79 ch := make(chan LineOutput)
80 go func() {
81 defer close(ch)
82 err := StreamToLines(input, func(line []byte) {
83 ch <- LineOutput{Line: string(line)}
84 }, nil)
85 if err != nil && err != io.EOF {
86 ch <- LineOutput{Error: err}
87 }
88 }()
89 return ch
90}
91
92// LineWriter is an io.Writer that processes data line-by-line via a callback.
93// Lines do not include the trailing newline. Lines longer than maxLineLength are dropped.

Callers 2

StartConnServerMethod · 0.92
StartConnServerMethod · 0.92

Calls 1

StreamToLinesFunction · 0.70

Tested by

no test coverage detected