MCPcopy Create free account
hub / github.com/UiPath/uipathcli / formatBytesInUnit

Method formatBytesInUnit

utils/visualization/progress_bar.go:113–124  ·  view source on GitHub ↗
(count int64, unit string)

Source from the content-addressed store, hash-verified

111}
112
113func (b *ProgressBar) formatBytesInUnit(count int64, unit string) (string, string) {
114 if unit == "B" {
115 return strconv.FormatInt(count, 10), unit
116 }
117 if unit == "kB" {
118 return fmt.Sprintf("%0.1f", float64(count)/1_000), unit
119 }
120 if unit == "MB" {
121 return fmt.Sprintf("%0.1f", float64(count)/1_000_000), unit
122 }
123 return fmt.Sprintf("%0.1f", float64(count)/1_000_000_000), unit
124}
125
126func NewProgressBar(logger log.Logger) *ProgressBar {
127 return &ProgressBar{logger, 0}

Callers 2

renderProgressMethod · 0.95
formatBytesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected