+
Skip to content

Jaeyo/tail-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tail-reader

Latest Release Go Doc Software License Go ReportCard

The reader that reads from the tail of the file line by line.

When to use

ex) periodically access the log file and read only newly added

Usage

bufferSize := 1024
reader, err := tailreader.New(file, bufferSize)
if err != nil {
    // handle error
    ...
}
defer reader.Close()

for reader.HasNext() {
	line, _ := reader.Read()
	fmt.Println(line)
}

// if file content is below:
//  aaa
//  bbb
//  ccc
//
// then this code prints below:
//  ccc
//  bbb
//  aaa

About

read file from bottom to top

Resources

License

Stars

Watchers

Forks

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载