chmodSync

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

function · experimental · requires --allow-write

function chmodSync(path: string | URL, mode: number): void

Synchronously changes the permission of a specific file/directory of specified path. Ignores the process's umask.

Requires allow-write permission.

For a full description, see chmod.

NOTE: This API currently throws on Windows.

path: string | URL

The path to the file or directory.

mode: number

A sequence of 3 octal numbers representing permissions. See chmod.

Example: Usage

import { chmodSync } from "@ende/fs/unstable-chmod";

chmodSync("README.md", 0o666);

Source