Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 521 Bytes

README.md

File metadata and controls

20 lines (15 loc) · 521 Bytes

readchan

GoDoc

Package readchan provides methods for iterating over an io.Reader by block or line, and reading the results via a channel.

f, err := os.Open("file.txt")
if err != nil {
  log.Fatal(err)
}

for line := range readchan.Lines(context.TODO(), f, 1) {
  if line.Err != nil {
    log.Fatal(err)
  }
  fmt.Printf("LINE: %q\n", line.Data)
  line.Done()
}