github.com/jonasnick/go-ethereum@v0.7.12-0.20150216215225-22176f05d387/ethutil/size.go (about) 1 package ethutil 2 3 import "fmt" 4 5 type StorageSize float64 6 7 func (self StorageSize) String() string { 8 if self > 1000000 { 9 return fmt.Sprintf("%.2f mB", self/1000000) 10 } else if self > 1000 { 11 return fmt.Sprintf("%.2f kB", self/1000) 12 } else { 13 return fmt.Sprintf("%.2f B", self) 14 } 15 }