Skip to contents

This function takes the path to a file and returns its size in a format that is easy to read (e.g., KB, MB, GB), using the gdata::humanReadable function.

Usage

FileSize(File, ...)

Arguments

File

character; the path to the file whose size you want to check.

...

additional arguments passed to the gdata::humanReadable function, allowing for further customization of the output format.

Value

A character string representing the size of the file in a human-readable format.

Examples

(f <- system.file("ex/elev.tif", package="terra"))
#> [1] "/home/runner/work/_temp/Library/terra/ex/elev.tif"

FileSize(File = f)
#> [1] "7.8 KiB"