Beispiel #1
0
func main() {
	usage, err := du.Get(os.Args[1])
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Free:", usage.FreeBytes/(KB*KB), "MiB")
	fmt.Println("Available:", usage.AvailBytes/(KB*KB), "MiB")
	fmt.Println("Size:", usage.TotalBytes/(KB*KB), "MiB")
}
Beispiel #2
0
func DiskFreePercentage(path string) (freePct float64, err error) {
	u, err := du.Get(path)
	return (float64(u.FreeBytes) / float64(u.TotalBytes)) * 100, err
}
Beispiel #3
0
func DiskFreeBytes(path string) (free int64, err error) {
	u, err := du.Get(path)
	return u.FreeBytes, err
}
Beispiel #4
0
func DuPath(path string) (free int64, err error) {
	u, err := du.Get(path)
	fmt.Println("Path:", path, "FreeBytes:", u.FreeBytes, "TotalBytes:", u.TotalBytes)
	return u.FreeBytes, err
}