ReadDir()
ts
ReadDir(path: string, sortBy: string, sortDir: string): respDir;Reads the contents of a directory in the target file-system or object storage, returning information about the files and subdirectories it contains.
Parameters
| Parameter | Type | Explanation |
|---|---|---|
path | string | The fully qualified root-based directory path to list (e.g., /data or C:\\Data) |
sortBy | DirSortBy | One of: SortByNameDirsFirst, SortByName, SortBySize, SortByTime |
sortDir | DirSortDir | One of: SortAsc (ascending), SortDesc (descending) |
Returns a respDir object.
Example
ts
var vfs = GetCurrentVFS();
if (vfs != null) {
var resp = vfs.ReadDir("/data", SortByNameDirsFirst, SortAsc);
if (resp.Ok()) {
Log(JSON.stringify(resp.Infos()));
} else {
Log(resp.ErrorMsg());
}
} else {
Log("VFS was null");
}