# README
Go Live Read
A module that enables you to concurrently read a file and do something with the data.
Installation
go get github.com/AspieSoft/go-liveread
Usage
import (
"github.com/AspieSoft/go-liveread"
)
func main(){
reader, err := liveread.Read("my/file.txt")
// read/peek at the first 4 bytes
b, err := reader.Get(0, 4)
// read/peek at 4 bytes starting at index 12
b, err := reader.Get(12, 4)
// peek at the next 10 bytes
b, err := reader.Peek(10)
// discard the bytes that you no longer need to read
discarded, err := reader.Discard(10)
// read until you reach a specific byte
b, err := reader.ReadBytes('\n')
// similar to ReadBytes, but does not discard automatically
// also allows you to specify a starting point
b, err := reader.PeekBytes(0, '\n')
// read to a byte array instead of just a single byte
b, err := reader.ReadToBytes([]byte("/>"))
}
# Functions
Read a file and concurrently peek at the bytes before it is done being read
@path: the file path you wish to read
@bufSize: the number of bytes to read at a time (min = 10, max = maxLen/4)
Type {uint8|uint16}: this sets the maxLen for how many bytes can be read to the queue before the overflow is used.
# Variables
ERROR_EOF is an alias of `io.EOF`.
ERROR_EOF_Save is only returned when using restore points
in most cases, you will need to use `io.EOF` to check for EOF errors.