utils

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFile added in v0.7.0

func ExtractFile(urlStr string) (string, error)

ExtractFile extracts the file name from a URL string from an index backup.

func FormatCVE added in v0.11.3

func FormatCVE(bareCve string) string

func FormatETA added in v0.9.0

func FormatETA(eta time.Duration) string

func GetDateHuman added in v0.9.0

func GetDateHuman(date time.Time) string

func GetDirectorySize added in v0.7.0

func GetDirectorySize(path string) (uint64, error)

GetDirectorySize calculates the total size of a directory and returns it as a human-readable string

func GetPlatformAssetName added in v0.11.4

func GetPlatformAssetName(version string) (string, error)

func GetSizeHuman added in v0.7.0

func GetSizeHuman(size uint64) string

func NormalizeString

func NormalizeString(s string) string

NormalizeString normalizes a string by converting it to lowercase and replacing spaces and underscores with hyphens.

func ParseDate added in v0.7.0

func ParseDate(date string) string

ParseDate parses a date string in RFC3339 format and returns a formatted string.

func TrimVersionString added in v0.11.4

func TrimVersionString(version ...string) string

func Unzip added in v0.7.0

func Unzip(src, dest string) error

Types

type ETACalculator added in v0.9.0

type ETACalculator struct {
	// contains filtered or unexported fields
}

func NewETACalculator added in v0.9.0

func NewETACalculator() *ETACalculator

func (*ETACalculator) TotalTime added in v0.9.0

func (e *ETACalculator) TotalTime() time.Duration

func (*ETACalculator) TotalTimeFormatted added in v0.9.0

func (e *ETACalculator) TotalTimeFormatted() string

func (*ETACalculator) Update added in v0.9.0

func (e *ETACalculator) Update(progress int) (float64, time.Duration)

Jump to

Keyboard shortcuts

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