Documentation
¶
Overview ¶
Package progress implements file transfer progress tracking with concurrent progress bars (Tracker) and a no-op implementation (Noop) for when tracking is disabled, both implementing the Trackable interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Noop ¶
type Noop struct{}
Noop is a dummy progress tracker that implements the Trackable interface but performs no tracking. Useful when progress display is disabled.
func (*Noop) TrackProgress ¶
func (n *Noop) TrackProgress(_ string, _, _ int64, rc io.ReadCloser) io.ReadCloser
TrackProgress returns the unmodified stream without wrapping.
type Trackable ¶
type Trackable interface {
Start()
Wait()
TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
}
Trackable defines the interface for progress tracking implementations.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker tracks multiple concurrent progress bars and renders them.
func New ¶
func New() *Tracker
New initializes and returns a Tracker with default styles and settings.
func (*Tracker) Start ¶
func (pt *Tracker) Start()
Start begins rendering progress bars in a separate goroutine.
func (*Tracker) TrackProgress ¶
func (pt *Tracker) TrackProgress( src string, currentSize, totalSize int64, stream io.ReadCloser, ) io.ReadCloser
TrackProgress wraps the given ReadCloser to update the progress bar during read and on close.