Skip to content

jbardin/readchan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()
}

About

Read files via a channel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages