Skip to Content
APIchmod

chmod

Change the permissions of a file or directory (mode bits).

Basic usage

import { chmod } from '@vooya/fs' await chmod('./script.sh', 0o755) await chmod('./file.txt', 0o644)

Methods

chmod(path, mode)

Async. Returns Promise<void>.

ArgumentTypeDescription
pathstringFile or directory path.
modenumberNumeric mode (e.g. 0o755, 0o644).

chmodSync(path, mode)

Sync. Same arguments; throws on error.

Performance

Single syscall; on par with Node.js. See Benchmarks.

Notes

  • Windows: Mode has limited meaning on Windows (mainly read-only); same as Node.js.
  • Current Windows gap: Vooya FS currently validates path existence but does not fully mirror Node’s readonly-related chmod behavior on Windows.
  • Known gap: Missing-path errors currently have Node-like messages, but do not expose Node-style code, path, and syscall fields yet.
  • Unsupported Node inputs: String mode values, Buffer paths, and URL paths are not part of the current Vooya FS chmod surface.

Competitor measurements

See the full chmod comparison table for Node 22/24, peer libraries, sync/Promise modes, small and batch workloads, execution routes and measurement limits.

Last updated on