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>.
| Argument | Type | Description |
|---|---|---|
path | string | File or directory path. |
mode | number | Numeric 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, andsyscallfields yet. - Unsupported Node inputs: String mode values,
Bufferpaths, andURLpaths are not part of the current Vooya FSchmodsurface.
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