Convert human readable units to what the computer understands
- Storage units: B, KB, MB, GB, TB, PB
-
Install the library
go get github.com/short-d/unit
-
Parse human readable unit
import "github.com/short-d/unit" oneWeekStr := "1w" oneWeek, err := unit.ParseDuration(oneWeekStr)
This project is maintained under MIT license.