FileSystemManager.stat
JS
Stats FileSystemManager.stat(Object object)Get the file Stats object
Parameters
- Object object: Input parameters; see the table below for details
Properties of object:
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| path | string | Yes | File/directory path | |
| recursive | bool | false | No | Whether to recursively get the Stats info of each file in the directory |
| success | function | No | Callback function when the call succeeds | |
| fail | function | No | Callback function when the call fails | |
| complete | function | No | Callback function when the call completes |
Parameters of the success callback function
- Object res: Returns the file information
Properties of res:
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message; see the table below for details |
| stats | Stats/Object | When recursive is false, res.stats is a Stats object; see the table below for details. When recursive is true and path is a directory path, res.stats is an Object whose key is the relative path with path as the root and whose value is the Stats object corresponding to that path |
Valid values of errMsg:
| Value | Description |
|---|---|
| stat:ok | The call succeeded |
Properties of Stats
| Property | Type | Description |
|---|---|---|
| mode | string | The file type and access permissions, corresponding to POSIX stat.st_mode |
| size | number | File size, in bytes (B) |
| lastAccessedTime | number | The time the file was last accessed or executed, as a UNIX timestamp |
| lastModifiedTime | number | The time the file was last modified, as a UNIX timestamp |
Parameters of the fail callback function
- Object res: Returns the error information
Properties of res:
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message |
Valid values of errMsg:
| Value | Description |
|---|---|
| fail permission denied | No read permission |
| fail no such file or directory | The file does not exist |
