io

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v0.2.0

func Copy(dst io.Writer, src io.Reader, buf []byte, cb CopyCallback) (written int64, err error)

Copy is a modification of io.copyBuffer. It runs the given callback after every chunk. If it returns true the copy will be resumed, on false it'll abort the copy

func CopyWithSlowBar added in v0.2.0

func CopyWithSlowBar(dest io.Writer, src io.Reader, tooLong time.Duration, makeBar BarMaker) (written int64, err error)

CopyWithSlowBar does an io copy that displays a progress bar if the copy takes too long.

func NewReader

func NewReader(src io.Reader) io.Reader

NewReader creates a new reader to consume This will limit the reader to 1MB/s

Types

type BarMaker added in v0.2.0

type BarMaker func() *pb.ProgressBar

BarMaker is a function that allows you to create a bar on demand for functions that might need it during their run time. For example, CopyWithSlowBar runs it if the copy takes too long by running this function to allow bar customization.

type CopyCallback added in v0.2.0

type CopyCallback func(written int64) bool

CopyCallback is a callback you can use to hook into a copy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL