Skip to content

setOwner

Sets the owner of a file or directory.

Example

ts
import { 
SF
} from "@duplojs/server-utils";
const
result
= await
SF
.
setOwner
("/tmp/file.txt", {
userId
: 1000,
groupId
: 1000,
}); // result: E.Ok | SF.FileSystemLeft await
SF
.
setOwner
("/tmp/app.log", {
userId
: 0,
groupId
: 0,
});

Syntax

typescript
function setOwner(
  path: string | URL,
  params: {
    userId: number;
    groupId: number;
  }
): Promise<FileSystemLeft | E.Ok>

Parameters

  • path : target path.
  • params.userId : identifiant utilisateur.
  • params.groupId : identifiant groupe.

Return value

  • E.Ok : if the operation succeeds.
  • FileSystemLeft : if the operation fails.

See also

  • setMode - Sets permissions for a file or directory.

Released under the MIT license.