UCE Docs / file_stat

Signature

DValue file_stat(String path)

Parameters

path : path to inspect, resolved against the unit's directory
return value : a map with exists, isfile, isdir, is_symlink, size, mode, mtime, ctime

Returns metadata about a path as a DValue map. Read fields with the usual accessors, e.g. st["size"].to_u64() and st["is_file"].to_bool(). When the path does not exist, exists is false.

Example

file_put_contents("/tmp/doc-stat.txt", "12345");
DValue st = file_stat("/tmp/doc-stat.txt");
print("size=", st["size"].to_u64(), " is_file=", st["is_file"].to_bool() ? "yes" : "no", "\n");
Output
size=5 is_file=yes