progress

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

func CalculatePercentage(value, total float64) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL