updated create,restore commands for backup directory and added utils.go
file
This commit is contained in:
1 parent
7df9eeb8eb
commit
3bef3f76e9
4 files changed
+125
-49
No files matched your search
@@ -0,0 +1,16 @@
|
||||
package cmd
|
||||
|
||||
import "fmt"
|
||||
|
||||
func formatBytes(b int64) string {
|
||||
const unit = 1024
|
||||
if b < unit {
|
||||
return fmt.Sprintf("%d B", b)
|
||||
}
|
||||
div, exp := int64(unit), 0
|
||||
for n := b / unit; n >= unit; n /= unit {
|
||||
div *= unit
|
||||
exp++
|
||||
}
|
||||
return fmt.Sprintf("%.1f %ciB", float64(b)/float64(div), "KMGTPE"[exp])
|
||||
}
|
||||
Reference in new issue
Block a user