progress

package
v0.0.0-...-b7a57f2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {
	// contains filtered or unexported fields
}

Progress tracks progress rendering at a certain interval on a new line the current percentage of bytes added from a total of maxBytes

Inspired by https://github.com/schollz/progressbar

func NewProgress

func NewProgress(maxBytes int64, description string, intervalToShow time.Duration) *Progress

NewProgress initialize a new progress ready to use

func (*Progress) Add

func (p *Progress) Add(num int)

Add will add the specified amount to the progressbar

func (*Progress) Add64

func (p *Progress) Add64(num int64)

Add64 will add the specified amount to the progressbar

func (*Progress) Finish

func (p *Progress) Finish()

Finish sets the current progress to 100%

type Reader

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

Reader will wrap an io.Reader adding progress functionality

func NewReader

func NewReader(r io.Reader, bar *Progress) Reader

NewReader return a new Reader with a given progress

func (*Reader) Close

func (r *Reader) Close() (err error)

Close the reader when it implements io.Closer

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read will read n bytes and track progress

Jump to

Keyboard shortcuts

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