Documentation
¶
Overview ¶
Package progress provides utilities for tracking progress of operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupProgressReader ¶
SetupProgressReader creates a progress reader if needed. SetupProgressReader creates a progress-aware reader that wraps the provided io.Reader. It returns an error if the input reader is nil, and if the progress function is nil, the original reader is returned unmodified. If the reader supports seeking (io.Seeker), it determines the total size of the content by seeking to the end and then restoring the original position before wrapping it with NewReader.
Types ¶
type ProgressFunc ¶
- message: A descriptive message about the current operation.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps an io.Reader to track progress.
func NewReader ¶
func NewReader(reader io.Reader, total int64, progressFunc ProgressFunc) *Reader
NewReader creates a new progress-tracking Reader that wraps the provided io.Reader. It uses the given total byte count to monitor progress and, if provided, calls the progressFunc with updates that include the current progress and a descriptive message.