Block size

This commit is contained in:
obscuren
2014-08-25 12:53:06 +02:00
parent 3f904bf3ac
commit 6afc16399f
4 changed files with 35 additions and 2 deletions

15
ethutil/size.go Normal file
View File

@ -0,0 +1,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)
}
}