progress

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 4 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 {

	// Writer .
	Writer io.Writer
	// contains filtered or unexported fields
}

Progress is used to track the progress of any I/O operation that are being performed.

func NewProgress

func NewProgress(total uint64) *Progress

NewProgress returns a new progress tracker for the given total size.

func (*Progress) Progress

func (p *Progress) Progress(width int) string

Progress returns a formatted progress string for the current progress.

func (*Progress) SetTotal

func (p *Progress) SetTotal(total uint64)

SetTotal sets the total size of the archive in bytes. This function is safe to call concurrently and can be used to update the total size if it changes, such as when the total size is simultaneously being calculated as data is being written through the progress writer.

func (*Progress) Total

func (p *Progress) Total() uint64

Total returns the total size in bytes.

func (*Progress) Write

func (p *Progress) Write(v []byte) (int, error)

Write totals the number of bytes that have been written to the writer.

func (*Progress) Written

func (p *Progress) Written() uint64

Written returns the total number of bytes written. This function should be used when the progress is tracking data being written.

Jump to

Keyboard shortcuts

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