Skip to content

Chmod

[<Interface>]
type Chmod =
    abstract member Invoke (path: PathLike, mode: Mode, callback: NoParamCallback) : unit
    abstract member __promisify__ (path: PathLike, mode: Mode) : Promise<unit>
AssemblyXantham.Fable.Node

Methods

abstract member Invoke (path: PathLike, mode: Mode, callback: NoParamCallback) : unit

Asynchronously changes the permissions of a file. No arguments other than a possible exception are given to the completion callback.

See the POSIX chmod(2) documentation for more detail.

import { chmod } from 'node:fs';

chmod('my_file.txt', 0o775, (err) => {
if (err) throw err;
console.log('The permissions for file "my_file.txt" have been changed!');
});

@since v0.1.30

abstract member __promisify__ (path: PathLike, mode: Mode) : Promise<unit>

Asynchronous chmod(2) - Change permissions of a file.

Parameter
pathA path to a file. If a URL is provided, it must use the file: protocol.
modeA file mode. If a string is passed, it is parsed as an octal integer.