Documentation
¶
Overview ¶
Package progress provides progress tracking for I/O operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback func(current, total int64)
Callback is called with current bytes processed and total size. For uploads, current is bytes written. For downloads, current is bytes read.
type Reader ¶
type Reader struct {
R io.Reader
Total int64
OnUpdate Callback
// contains filtered or unexported fields
}
Reader wraps an io.Reader to report read progress. This is useful for tracking download progress.
func NewReader ¶
NewReader creates a progress reader wrapping the given reader. total is the expected total bytes (use -1 if unknown). onUpdate is called after each Read with current and total bytes.
type Writer ¶
type Writer struct {
W io.Writer
Total int64
OnUpdate Callback
// contains filtered or unexported fields
}
Writer wraps an io.Writer to report write progress. This is useful for tracking upload progress.
func NewWriter ¶
NewWriter creates a progress writer wrapping the given writer. total is the expected total bytes (use -1 if unknown). onUpdate is called after each Write with current and total bytes.
func (*Writer) BytesWritten ¶
BytesWritten returns the total bytes written so far.