-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
# peek-a-buf | ||
# Peek-A-Buf | ||
|
||
Peek-A-Buf is a Go library for a buffered reader with side effect free peeking capability. | ||
|
||
At the moment, a buffered reader for runes is implemented meant for things like scanners. | ||
|
||
Why is this useful if `bufio.Reader` exists? Well, the Peek function is sadly not side effect | ||
free there: | ||
|
||
> Calling Peek prevents a UnreadByte or UnreadRune call from succeeding until the next read | ||
> operation. | ||
But this was something needed to fix a bug in the | ||
[SQLDumpSplitter3](https://philiplb.de/sqldumpsplitter3). So I created this little library | ||
basically wrapping `bufio.Reader` and re-implementing small parts of it. | ||
|
||
In addition to the side effect free peek function, it returns an `EOF` rune instead of an | ||
error if it reaches the end of the buffer. | ||
|
||
Have a look at the **[documentation](https://godoc.org/github.com/philiplb/peekabuf)**. | ||
|
||
## Installation | ||
|
||
Just `go get` it: | ||
|
||
```bash | ||
go get github.com/philiplb/peekabuf | ||
``` | ||
|
||
## License | ||
[MIT](https://choosealicense.com/licenses/mit/) |