rclone/vendor/storj.io/common/memory/string.go

17 lines
396 B
Go
Raw Normal View History

2020-05-12 02:57:46 +08:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package memory
// FormatBytes converts number of bytes to appropriately sized string.
2020-05-12 02:57:46 +08:00
func FormatBytes(bytes int64) string {
return Size(bytes).String()
}
// ParseString converts string to number of bytes.
2020-05-12 02:57:46 +08:00
func ParseString(s string) (int64, error) {
var size Size
err := size.Set(s)
return size.Int64(), err
}