Capy-Bearer Documentation

file_chmod

lib call

Capy

function file_chmod(path : string, mode : string) any

Description

file_chmod changes the permission bits of a path.

Parameters

path : path of the file or directory

mode : Unix permission bits as an octal string, for example "0600"

Return Values

A map with ok and error. ok is true when Capy changes the mode. error holds the failure reason when the call fails.

Example

Capy

file_put_contents("/tmp/doc-chmod.txt", "secret")
print(get(file_chmod("/tmp/doc-chmod.txt", "0600"), "ok"), "\n")

Output

true