du

package
v0.0.0-...-8dfad59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 1 Imported by: 0

README

go-disk-usage

Get disk usage information like how much space is available, free, and used.

Compatibility

This works for Windows, MacOS, and Linux although there may some minor variability between what this library reports and what you get from df.

Usage

import "github.com/bingoohuang/ngg/rotatefile/du"
usage := du.New("/path/to")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskUsage

type DiskUsage struct {
	// contains filtered or unexported fields
}

DiskUsage contains usage data and provides user-friendly access methods

func NewDiskUsage

func NewDiskUsage(volumePath string) (*DiskUsage, error)

NewDiskUsage returns an object holding the disk usage of volumePath or nil in case of error (invalid path, etc.)

func (*DiskUsage) Available

func (du *DiskUsage) Available() uint64

Available return total available bytes on file system to an unprivileged user

func (*DiskUsage) Free

func (du *DiskUsage) Free() uint64

Free returns total free bytes on file system

func (*DiskUsage) Size

func (du *DiskUsage) Size() uint64

Size returns total size of the file system

func (*DiskUsage) Usage

func (du *DiskUsage) Usage() float32

Usage returns percentage of use on the file system

func (*DiskUsage) Used

func (du *DiskUsage) Used() uint64

Used returns total bytes used in file system

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL