Skip to content

Chown()

ts
Chown(path: string, uid: number, gid: number): respBase;

Changes the owner user and group IDs on an object (file or directory) in the target file system.

WARNING

This method may or may not be supported depending on the file-system targeted by the VFS.

Parameters

ParameterTypeExplanation
pathstringThe fully qualified root-based target path to the file/directory you wish to change ownership of
uidnumberThe OS-issued, numerical UID (user ID) of the new owner
gidnumberThe OS-issued, numerical GID (group ID) of the new owner's group

Returns a respBase object.

Example

ts
var vfs = GetCurrentVFS();
if (vfs != null) {
    var resp = vfs.Chown("/data/backup.zip", 1000, 1000);
    if (resp.Ok()) {
        Log("Ownership changed");
    } else {
        Log("Error: " + resp.ErrorMsg());
    }
} else {
    Log("VFS was null");
}