TreeSize (recursive size)
ts
function TreeSize(path: string): respSize;Calculates the total size (in bytes) of the file or directory specified by path, including all nested files and subdirectories, in the VFS. Returns a respSize object with the result.
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
path | string | required | Path to a file or directory to measure |
| Return type | Description |
|---|---|
respSize | Contains the total size in bytes; use Ok() and Size() to check the result and retrieve the value |
Example
ts
var result = vfs.TreeSize('/data/project');
if (result.Ok()) {
Log('Total size: ' + result.Size() + ' bytes');
} else {
Log('TreeSize failed: ' + result.ErrorMsg());
}