Skip to content

jeroiraz/goback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backward Reader

This buffered reader is optimized for reading append-only files with dangling links to previous content.

Chunks of data are read starting at the end but interpretation of data takes is done from left to right. Thus, this reader can be used as bufio.Reader but internal buffering is filled with content at lower offsets.

This backward reader may be used with size endian records, where the field storing the size of the record is at the end.

Installation

go get github.com/jeroiraz/goback

Example

package main

import (
  "os"
  "github.com/jeroiraz/goback"
)

func main() {
  f, _ := os.Open("file")
  defer f.Close()

  reader, _ := goback.NewFileReader(f)

  // Read last 32 bytes from input file
  buf := make([]byte, 32)
  reader.Read(buf)
}

About

Backward Reader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages