progress

package
v1.117.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package progress implements a small byte-progress meter on top of charm.land/bubbles/v2/progress, for use in place of github.com/schollz/progressbar/v3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

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

Bytes is an io.WriteCloser that renders a labeled progress bar to os.Stderr as bytes are written through it. Wrap it around a transfer with io.MultiWriter (for an io.Writer destination) or io.TeeReader (for an io.Reader source).

If total is <= 0 (e.g. the size wasn't known ahead of time), Bytes falls back to reporting only the count of bytes transferred, since a percentage can't be computed.

If os.Stderr isn't a terminal, Bytes prints an occasional plain text status line instead of redrawing a bar in place, so piped or logged output isn't filled with redraw escape codes.

func NewBytes

func NewBytes(total int64, description string) *Bytes

NewBytes returns a Bytes progress meter for a transfer of total bytes (pass <= 0 if the size isn't known ahead of time), labeled with description.

func (*Bytes) Close

func (b *Bytes) Close() error

Close redraws the progress bar a final time to reflect the final byte count and prints a trailing newline. It's safe to call multiple times.

func (*Bytes) Write

func (b *Bytes) Write(p []byte) (int, error)

Write implements io.Writer, recording len(p) bytes as transferred and redrawing the progress bar if enough time has passed since the last redraw. It never returns an error.

Jump to

Keyboard shortcuts

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