progress

package
v2.8.0-nightly.20230801 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable()

Disable turns off printing of progress bars.

func Wait

func Wait()

Wait for all progress bars to complete, should be called when using progress to avoid the program exiting before the final progress update can be drawn.

func WriteProgress added in v2.7.0

func WriteProgress(bar string, completion int64, total int64)

func WriteProgressCountBytes added in v2.7.0

func WriteProgressCountBytes(bar string, current int64, final bool, priority int)

Types

type File

type File struct {
	*os.File
	// contains filtered or unexported fields
}

File is a wrapper around a file which updates a progress bar as it's read.

func Create

func Create(path string, size int64) (*File, error)

Create is identical to os.Create except that file is wrapped in a progress bar that updates as you write to it.

func Open

func Open(path string) (*File, error)

Open is identical to os.Open except that file is wrapped in a progress bar that updates as you read from it .

func OpenAppend

func OpenAppend(path string, appendSize int64) (*File, error)

func Stdin

func Stdin() *File

Stdin returns os.Stdin except that it's wrapped in a progress bar that updates as you read from it.

func (*File) Close

func (f *File) Close() error

Close closes the wrapped file and finishes the progress bar.

func (*File) Finish

func (f *File) Finish()

Finish finishes the progress bar without closing the wrapped file, this should be used if the wrapped file is something you don't want to close (for example stdin), but you don't want future reads to be printed as progress.

func (*File) Read

func (f *File) Read(p []byte) (int, error)

Read reads bytes from wrapped file and adds amount of bytes read to the progress bar

func (*File) ReadFrom

func (f *File) ReadFrom(r io.Reader) (int64, error)

ReadFrom writes the contents of r to f and adds the amount of bytes written to the progress bar

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek seeks the wrapped file and updates the progress bar.

func (*File) Write

func (f *File) Write(p []byte) (int, error)

Write writes bytes to the wrapped file and adds amount of bytes written to the progress bar

func (*File) WriteAt

func (f *File) WriteAt(b []byte, offset int64) (int, error)

WriteAt writes to the wrapped file at the given offset and adds amount of bytes written to the progress bar

Jump to

Keyboard shortcuts

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