Skip to Content
APIchown

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>.

ArgumentTypeDescription
pathstringFile or directory path.
uidnumberNumeric user id.
gidnumberNumeric 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, and syscall fields yet.
  • Unsupported Node path inputs: Buffer paths and URL paths are not part of the current Vooya FS chown surface.

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