disk-free-space-0.1.0.1: Retrieve information about disk space usage

Stability | provisional
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

System.DiskSpace

Description

Synopsis

- data DiskUsage = DiskUsage {
  - diskTotal :: Integer
  - diskFree :: Integer
  - diskAvail :: Integer
  - blockSize :: Int
  }
- getDiskUsage :: FilePath -> IO DiskUsage
- getAvailSpace :: FilePath -> IO Integer

# Documentation

data DiskUsage Source #

Disk usage information. All fields are in bytes.

Constructors

DiskUsage |

Fields

- diskTotal :: Integer

  The total size of the file system.

- diskFree :: Integer

  The amount of free space. You probably want to use `diskAvail` instead.

- diskAvail :: Integer

  The amount of space available to the user. Might be less than `diskFree`. On Windows, this is always equal to `diskFree`. This is what most tools report as free space (e.g. the unix `df` tool).

- blockSize :: Int

  The optimal block size for I/O in this volume. Some operating systems report incorrect values for this field.

#### Instances

Instances details

Show DiskUsage Source # |
Instance details Defined in System.DiskSpace Methods showsPrec :: Int -> DiskUsage -> ShowS Source # show :: DiskUsage -> String Source # showList :: [DiskUsage] -> ShowS Source #
Eq DiskUsage Source # |
Instance details Defined in System.DiskSpace Methods (==) :: DiskUsage -> DiskUsage -> Bool Source # (/=) :: DiskUsage -> DiskUsage -> Bool Source #

getDiskUsage :: FilePath -> IO DiskUsage Source #

Retrieve disk usage information about a volume. The volume is specified with the `FilePath` argument. The path can refer to the root directory or any other directory inside the volume. Unix systems also accept arbitrary files, but this does not work under Windows and therefore should be avoided if portability is desired.

getAvailSpace :: FilePath -> IO Integer Source #

A convenience function that directly returns the `diskAvail` field from the result of `getDiskUsage`. If a large amount of data is to be written in a directory, calling this function for that directory can be used to determine whether the operation will fail because of insufficient disk space.