chown

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

function · experimental · requires --allow-write

async function chown(path: string | URL, uid: number | null, gid: number | null): Promise<void>

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 { chown } from "@ende/fs/unstable-chown";
await chown("README.md", 1000, 1002);

Source