This object is used to represent file status information from e.g. file_stat().
It contains the following items usually found in a C struct stat:
File mode (see mknod(2)).
File size in bytes.
User ID of the file's owner.
Group ID of the file's owner.
Time of last access in seconds since 00:00:00 UTC, 1970-01-01.
Time of last data modification.
Time of last file status change.
Time of last access in nanoseconds, added to atime to get sub-second time
Time of last modification in nanoseconds, added to mtime to get sub-second time
Time of last file status change in nanoseconds, added to ctime to get sub-second time
Number of links.
ID of the device containing a directory entry for this file.
ID of the device.
It also contains some items that correspond to the C IS* macros:
Set if the file is a regular file.
Set if the file is a directory.
Set if the file is a symbolic link. Note that symbolic links are normally followed by the stat functions, so this might only be set if you turn that off, e.g. by giving a nonzero second argument to file_stat().
Set if the file is a FIFO (aka named pipe).
Set if the file is a socket.
Set if the file is a character device.
Set if the file is a block device.
There are also some items that provide alternative representations of the above:
The type as a string, can be any of
The file mode encoded as a string in ls -l style, e.g.
Note that some items might not exist or have meaningful values on some platforms.
Additionally, the object may be initialized from or casted to an
arrayon the form of a 'traditional' LPC stat-array, and it's also possible to index the object directly with integers as if it were such an array. The stat-array has this format:
File mode, same as mode.
If zero or greater, the file is a regular file and this is its size in bytes. If less than zero it gives the type: -2=directory, -3=symlink and -4=device.
Time of last access, same as atime.
Time of last data modification, same as mtime.
Time of last file status change, same as ctime.
User ID of the file's owner, same as uid.
Group ID of the file's owner, same as gid.
It's possible to modify the stat struct by assigning values to the items. They essentially work as variables, although some of them affect others, e.g. setting
mode_stringchanges many of the other items.
- Method create
A new Stdio.Stat object can be initialized in two ways: