Documentation
¶
Overview ¶
Package progress provides utility functions for progress tracking and other common tasks.
Package progress provides utility functions for progress calculation and tracking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultProgressBar = &progressBar{} //nolint:gochecknoglobals // Default progress bar instance
DefaultProgressBar is the default instance of a cheggaaa progress bar. It implements progress.Tracker for download progress display.
Functions ¶
func CalculatePercentage ¶
CalculatePercentage calculates the percentage of a given value relative to a total, formatted to two decimal places. It returns "0.00%" if the total is zero to prevent division by zero errors.
Types ¶
type DownloadProgress ¶ added in v0.6.2
type DownloadProgress interface {
Update(bytesComplete int64)
Finish()
}
DownloadProgress tracks the progress of a single download via polling updates.
type Tracker ¶ added in v0.6.2
type Tracker interface {
StartTracking(filename string, totalSize int64) DownloadProgress
}
Tracker creates download progress handles for tracking file downloads.
Click to show internal directories.
Click to hide internal directories.