Truncate()
ts
Truncate(filePath: string, size: number): respBase;Changes the size of the specified file in the target file-system.
WARNING
This method may or may not be supported depending on the file-system targeted by the VFS.
Parameters
| Parameter | Type | Explanation |
|---|---|---|
filePath | string | The fully qualified root-based path to the file you wish to truncate |
size | number | Desired new file size in bytes (zero or positive integer) |
Returns a respBase object.
Example
ts
var vfs = GetCurrentVFS();
if (vfs != null) {
var resp = vfs.Truncate("/data/myfile.txt", 0);
if (resp.Ok()) {
Log("File truncated");
} else {
Log("Error: " + resp.ErrorMsg());
}
} else {
Log("VFS was null");
}