feat: add File.stat() method and Stat class for filesystem metadata queries

Implement asynchronous stat() on File class returning a new Stat object with device, inode, mode, linkCount, user, group, specialDevice, size, blockSize, and blockCount fields populated from libuv uv_fs_stat callback. Register foreign method statPath_ in module registry, bump MAX_METHODS_PER_CLASS to 10, add Stat class to io.wren with indexed field accessors, update documentation index with Stat page, and include test coverage for stat on existing file and nonexistent path.
This commit is contained in:
Bob Nystrom
2016-01-01 17:58:44 +00:00
parent 3746b56ed9
commit f112722d00
11 changed files with 195 additions and 11 deletions
+50
View File
@@ -0,0 +1,50 @@
^title Stat Class
Contains the data returned by [File.stat()][stat].
[stat]: file.html#file.stat(path)
## Methods
### **device**
The ID of the device containing the entry.
### **inode**
The [inode][] number of the entry.
[inode]: https://en.wikipedia.org/wiki/Inode
### **mode**
A bit field describing the entry's type and protection flags.
### **linkCount**
The number of hard links to the entry.
### **user**
Numeric user ID of the file's owner.
### **group**
Numeric group ID of the file's owner.
### **specialDevice**
The device ID for the entry, if it's a special file.
### **size**
The size of the entry in bytes.
### **blockSize**
The preferred block size in bytes for interacting with the file. It may vary
from file to file.
### **blockCount**
The number of system blocks allocated on disk for the file.