More file system checking functions:

- Stat#isFile
- Stat#isDirectory
- Directory.exists()
- File.exists()
This commit is contained in:
Bob Nystrom
2016-02-21 12:23:33 -08:00
parent c6148f8941
commit 60162575ee
15 changed files with 149 additions and 28 deletions
+5
View File
@@ -4,6 +4,11 @@ A directory on the file system.
## Static Methods
### Directory.**exists**(path)
Whether a directory exists at `path`. This returns `false` for files or other
special file system entities.
### Directory.**list**(path)
Lists the contents of the directory at `path`. Returns a sorted list of path
+5
View File
@@ -25,6 +25,11 @@ automatically closed.
Deletes the file at `path`.
### File.**exists**(path)
Whether a regular file exists at `path`. This returns `false` for directories
or other special file system entities.
### File.**open**(path, fn)
Opens the file at `path` for reading and passes it to `fn`. After the function
+26 -17
View File
@@ -10,45 +10,54 @@ A data structure describing the low-level details of a file system entry.
## Methods
### **blockCount**
The number of system blocks allocated on disk for the file.
### **blockSize**
The preferred block size in bytes for interacting with the file. It may vary
from file to file.
### **device**
The ID of the device containing the entry.
### **group**
Numeric group ID of the file's owner.
### **inode**
The [inode][] number of the entry.
[inode]: https://en.wikipedia.org/wiki/Inode
### **mode**
### **isDirectory**
A bit field describing the entry's type and protection flags.
Whether the file system entity is a directory.
### **isFile**
Whether the file system entity is a regular file, as opposed to a directory or
other special entity.
### **linkCount**
The number of hard links to the entry.
### **user**
### **mode**
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.
A bit field describing the entry's type and protection flags.
### **size**
The size of the entry in bytes.
### **blockSize**
### **specialDevice**
The preferred block size in bytes for interacting with the file. It may vary
from file to file.
The device ID for the entry, if it's a special file.
### **blockCount**
### **user**
The number of system blocks allocated on disk for the file.
Numeric user ID of the file's owner.