starts a goroutine to drive the channel line output does not include the trailing newline
(input io.Reader)
| 76 | // starts a goroutine to drive the channel |
| 77 | // line output does not include the trailing newline |
| 78 | func 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. |
no test coverage detected