- stat = rawio.stat(filename)
- stat = rawio.stat(fd)
- stat = handle:stat()
SYNOPSIS
DESCRIPTION
The functions return information about a file. The first form takes a filename, the second uses an already open numeric file descriptor, while the third accesses an already open file handle.
RETURN VALUE
On success, returns a table with the requested information. On failure, the forms one and two return three values: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library. Form three just returns nil on failure, the error can be retrieved using rawio:lastError().
Not all files have usable values in all fields. Network connections do not have a size, for example.
Field | Contents |
---|---|
atime | Time of last access, a datetime instance. Not supported by FAT filesystems. |
blksize | Size of one block in the filesystem. |
blocks | Number of filesystem blocks used by the file. |
ctime | Time of last status change, a datetime instance. |
mode | The filesystem mode bits. (TODO: readable, writable, directory) |
mtime | Time of last modification, a datetime instance. |
nlink | Number of hard links. |
size | The size of the file in bytes. |
EXAMPLE
>
>
st = rawio.stat("/etc/fsexc8x16.lfn")
print(st.size)
7832