Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const KB = uint64(1024)
Variables ¶
This section is empty.
Functions ¶
func DiskRate ¶
DiskRate returns the usage rate of the disk where volumePath is located
Example ¶
package main import ( "fmt" "tcw.im/go-disk-usage/du" ) var KB = uint64(1024) func main() { // MB usage := du.New(".") fmt.Println("Free:", usage.Free()/(KB*KB)) fmt.Println("Available:", usage.Available()/(KB*KB)) fmt.Println("Size:", usage.Size()/(KB*KB)) fmt.Println("Used:", usage.Used()/(KB*KB)) fmt.Println("Usage:", usage.Usage()*100, "%") fmt.Println(du.DiskRate(".")) // Usage(percent) }
Output:
Types ¶
type DiskHumanReadable ¶
type DiskHumanReadable struct { Total uint64 Used uint64 Free uint64 Available uint64 Percent float32 // Decimal places, you might have to multiply by 100 }
Human-readable disk information, in KB (uint64)
func DiskInfo ¶
func DiskInfo(volumePath string) DiskHumanReadable
DiskInfo returns an instance of DiskHumanReadable (New it)
Click to show internal directories.
Click to hide internal directories.