Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBytes ¶
FormatBytes formats a byte count as a human-readable string (e.g., "1.5 MB").
func FormatDuration ¶
FormatDuration formats a duration as a human-readable string (e.g., "1m 30s").
func FormatSpeed ¶
FormatSpeed formats a speed as a human-readable string (e.g., "1.5 MB/s").
Types ¶
type Progress ¶
type Progress struct {
BytesRead int64
BytesPerSecond float64
Duration time.Duration
Fraction float64 // 0.0–1.0 upload fraction complete
ETA time.Duration // estimated time remaining; 0 if unknown
}
Progress represents a snapshot of the current upload stats.
type ProgressReader ¶
type ProgressReader struct {
// contains filtered or unexported fields
}
ProgressReader wraps an io.Reader and periodically reports upload progress.
func NewProgressReader ¶
func NewProgressReader(r io.ReadCloser, onProgress func(Progress)) *ProgressReader
NewProgressReader creates a new progress tracking reader that wraps the given io.Reader.
func (*ProgressReader) Close ¶ added in v0.2.0
func (pr *ProgressReader) Close() error
func (*ProgressReader) GetProgress ¶
func (pr *ProgressReader) GetProgress() Progress
GetProgress returns the current progress snapshot.
Click to show internal directories.
Click to hide internal directories.