2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-10-01 12:29:27 +01:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2018-09-28 13:40:08 +01:00
|
|
|
package memory
|
|
|
|
|
|
|
|
// FormatBytes converts number of bytes to appropriately sized string
|
|
|
|
func FormatBytes(bytes int64) string {
|
|
|
|
return Size(bytes).String()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ParseString converts string to number of bytes
|
|
|
|
func ParseString(s string) (int64, error) {
|
|
|
|
var size Size
|
|
|
|
err := size.Set(s)
|
|
|
|
return size.Int64(), err
|
|
|
|
}
|