Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosylilly/pio
io with progress
https://github.com/rosylilly/pio
golang golang-library io
Last synced: 5 days ago
JSON representation
io with progress
- Host: GitHub
- URL: https://github.com/rosylilly/pio
- Owner: rosylilly
- License: mit
- Created: 2021-04-08T07:45:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-08T10:14:01.000Z (over 3 years ago)
- Last Synced: 2024-12-22T13:14:55.993Z (15 days ago)
- Topics: golang, golang-library, io
- Language: Go
- Homepage: https://pkg.go.dev/github.com/rosylilly/pio
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pio - io with progress
[![Go Reference](https://pkg.go.dev/badge/github.com/rosylilly/pio.svg)](https://pkg.go.dev/github.com/rosylilly/pio)
[![test](https://github.com/rosylilly/pio/actions/workflows/test.yml/badge.svg)](https://github.com/rosylilly/pio/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/rosylilly/pio/branch/main/graph/badge.svg?token=kMUjFmnxRY)](https://codecov.io/gh/rosylilly/pio)## Example
```golang
package mainimport (
"bytes"
"errors"
"fmt"
"io"
"log"
"os""github.com/rosylilly/pio"
)func main() {
file, err := os.Open("README.md")
if err != nil {
log.Fatalln(err)
}logger := log.New(os.Stdout, "", log.Ltime)
reader, err := pio.NewReader(file, pio.WithLogger(logger))
if err != nil {
log.Fatalln(err)
}buffer := bytes.NewBuffer([]byte{})
for {
_, err := io.CopyN(buffer, reader, 100)
if err != nil {
if errors.Is(err, io.EOF) {
break
} else {
log.Fatalln(err)
}
}
}fmt.Println(buffer.String())
}
```[![asciicast](https://asciinema.org/a/405916.svg)](https://asciinema.org/a/405916)
## License
[MIT License](https://github.com/rosylilly/pio/blob/main/LICENSE)