chown
Change the owner and group of a file or directory (Unix). On Windows this is a no-op or limited.
Basic usage
import { chown } from '@vooya/fs'
await chown('./file', uid, gid)Methods
chown(path, uid, gid)
Async. Returns Promise<void>.
| Argument | Type | Description |
|---|---|---|
path | string | File or directory path. |
uid | number | Numeric user id. |
gid | number | Numeric group id. |
chownSync(path, uid, gid)
Sync. Same arguments; throws on error (e.g. EPERM).
Performance
Single syscall; on par with Node.js. See Benchmarks.
Notes
- Windows: Typically requires elevated privileges or has no effect; same as Node.js.
- Root: Changing ownership usually requires root/sudo on Unix.
- Current non-Unix gap: Vooya FS currently validates path existence but does not fully mirror platform ownership mutation semantics outside Unix.
- Known gap: Missing-path and permission errors currently have Node-like messages, but do not expose Node-style
code,path, andsyscallfields yet. - Unsupported Node path inputs:
Bufferpaths andURLpaths are not part of the current Vooya FSchownsurface.
Competitor measurements
See the full chown comparison table for Node 22/24, peer libraries, sync/Promise modes, small and batch workloads, execution routes and measurement limits.
Last updated on