chownSync

import { chownSync } from "jsr:@ende/fs/unstable-chown";

function · experimental · requires --allow-write

function chownSync(path: string | URL, uid: number | null, gid: number | null): void

Synchronously change owner of a regular file or directory.

This functionality is not available on Windows.

Requires allow-write permission.

Throws Error (not implemented) if executed on Windows.

path: string | URL

The path to the file/directory.

uid: number | null

The user id (UID) of the new owner, or null for no change.

gid: number | null

The group id (GID) of the new owner, or null for no change.

Example: Usage

import { chownSync } from "@ende/fs/unstable-chown";
chownSync("README.md", 1000, 1002);

Source