Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/fs.ts>chown

A JavaScript extension package for building strong and modern applications.
Latest
function chown
import { chown } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";

Changes the owner and group of the specified file or directory.

NOTE: This function is only available in Node.js, Deno and Bun, and only works in Unix/Linux systems, in other environments, it's a no-op.

Examples

Example 1

import { chown } from "@ayonli/jsext/fs";

// Change the owner and group of the file to root.
await chown("/path/to/file.txt", 0, 0);

Parameters

path: string
uid: number
gid: number

Returns

Promise<void>