file_stat
lib callCapy
function file_stat(path : string) any
Description
file_stat returns metadata for a path. size is in bytes. mtime and ctime are Unix timestamps in whole seconds. ctime records metadata changes, not file creation. mode is a numeric permission and special-bit mask, not an octal string.
Parameters
path : path to inspect
Return Values
A map with exists, is_file, is_dir, is_symlink, size, mtime, ctime, and mode.
Errors
A missing, denied, or otherwise unstatable path returns exists: false. All type flags are false, and numeric fields are zero. The map has no ok or error field. Check exists before you use the other fields.
Example
Capy
file_put_contents("/tmp/doc-stat.txt", "12345")
var stat := file_stat("/tmp/doc-stat.txt")
print(u64(stat["size"]), "\n")
Output
5