-
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.
add descriptive readme + remove autorelease gh workflow
- Loading branch information
1 parent
5d162ff
commit c9036eb
Showing
2 changed files
with
49 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,2 +1,50 @@ | ||
# bufio | ||
# bufio _fork: writer buffer injection_ | ||
|
||
[![godoc - documentation](https://godoc.org/github.com/ahmedabdou14/bufio?status.svg)](https://pkg.go.dev/github.com/ahmedabdou14/bufio) | ||
[![go report card](https://goreportcard.com/badge/github.com/ahmedabdou14/bufio)](https://goreportcard.com/report/github.com/ahmedabdou14/bufio) | ||
[![github action - test](https://github.com/ahmedabdou14/bufio/workflows/test/badge.svg)](https://github.com/ahmedabdou14/bufio/actions) | ||
[![codecov - code coverage](https://img.shields.io/codecov/c/github/ahmedabdou14/bufio.svg?style=flat-square)](https://codecov.io/gh/ahmedabdou14/bufio) | ||
|
||
A fork of Go's standard bufio package, adding support for buffer injected writers. | ||
|
||
## Installation | ||
|
||
```shell | ||
go get -u github.com/ahmedabdou14/bufio | ||
``` | ||
|
||
## Usage | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/ahmedabdou14/bufio" | ||
) | ||
|
||
func main() { | ||
file, err := os.Create("test.txt") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file.Close() | ||
|
||
buf := make([]byte, 10) | ||
|
||
w := bufio.NewWriterBuffer(file, buf) | ||
w.WriteString("Hello, World!") | ||
w.Flush() | ||
} | ||
``` | ||
|
||
## Why? | ||
|
||
Only use this package if you need the fine-grained control over the buffers used by the writer. One use case is when you want to reuse buffers for multiple writers **and** somewhere else in your code. For more details, checkout this [issue](https://github.com/golang/go/issues/69970) | ||
|
||
Maybe you do not need this package, in most usecases, you would only need to reuse the writers themselves, not the buffers. For more details, checkout this [issue](https://github.com/golang/go/issues/13650) | ||
|
||
## Warning ⚠️ | ||
|
||
Be carful of using the buffer after passing it to the writer. Doings so will result in unexpected behavior. |