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

Function StreamToLinesChan

tsunami/util/streamtolines.go:73–85  ·  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

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

Callers

nothing calls this directly

Calls 1

StreamToLinesFunction · 0.70

Tested by

no test coverage detected