MCPcopy
hub / github.com/kopia/kopia / BytesString

Function BytesString

internal/units/units.go:60–66  ·  view source on GitHub ↗

BytesString formats the given value as bytes with the unit provided from the environment.

(b T)

Source from the content-addressed store, hash-verified

58
59// BytesString formats the given value as bytes with the unit provided from the environment.
60func BytesString[T realNumber](b T) string {
61 if v, _ := strconv.ParseBool(os.Getenv(bytesStringBase2Envar)); v {
62 return BytesStringBase2(b)
63 }
64
65 return BytesStringBase10(b)
66}
67
68// BytesPerSecondsString formats the given value bytes per second with the appropriate base-10 suffix (KB/s, MB/s, GB/s, ...)
69func BytesPerSecondsString[T realNumber](bps T) string {

Callers 15

functionsFunction · 0.92
runMethod · 0.92
showBucketsMethod · 0.92
outputMethod · 0.92
runMethod · 0.92
appendFilesPolicyValueFunction · 0.92
runMethod · 0.92
snapshotSizeDeltaFunction · 0.92
maybeHumanReadableBytesFunction · 0.92

Calls 2

BytesStringBase2Function · 0.85
BytesStringBase10Function · 0.85

Tested by 2