aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/size.go
blob: b4426465e6139dcf558a2999f8130260f46530a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package ethutil

import "fmt"

type StorageSize float64

func (self StorageSize) String() string {
    if self > 1000000 {
        return fmt.Sprintf("%.2f mB", self/1000000)
    } else if self > 1000 {
        return fmt.Sprintf("%.2f kB", self/1000)
    } else {
        return fmt.Sprintf("%.2f B", self)
    }
}