Skip to main content

df

Disk information.

Attributes

AttributeTypeDescription
path`strbytes
total_blocksfloatThe total size of the file system in kilobytes, calculated from the block count and fragment size.
availablefloatThe amount of free space available to unprivileged users in kilobytes.
capacityintThe percentage of disk space currently in use, rounded up to the nearest integer.
statos.statvfs_resultThe cached raw file system statistics obtained from the os.statvfs call for the specified path.

Constructor

Signature

def df(
path: str | bytes | os.PathLike
) - > None

Parameters

NameTypeDescription
path`strbytes

Signature

def df(
path: str | bytes | os.PathLike
) - > None

Parameters

NameTypeDescription
path`strbytes

Methods


total_blocks()

@classmethod
def total_blocks() - > float

Calculates the total size of the filesystem in kilobytes.

Returns

TypeDescription
floatThe total capacity of the filesystem expressed in KB

available()

@classmethod
def available() - > float

Calculates the amount of free space available to unprivileged users.

Returns

TypeDescription
floatThe available free space on the filesystem expressed in KB

capacity()

@classmethod
def capacity() - > int

Calculates the percentage of disk space currently in use.

Returns

TypeDescription
intThe usage percentage rounded up to the nearest integer

stat()

@classmethod
def stat() - > os.statvfs_result

Retrieves the raw filesystem statistics using the statvfs system call.

Returns

TypeDescription
os.statvfs_resultAn object containing low-level filesystem attributes like block size and counts