Skip to content

Commit

Permalink
add descriptive readme + remove autorelease gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedabdou14 committed Oct 25, 2024
1 parent 5d162ff commit c9036eb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/release.yml

This file was deleted.

50 changes: 49 additions & 1 deletion README.md
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.

0 comments on commit c9036eb

Please sign in to comment.