Home Explore Blog CI



neovim

42th chunk of `runtime/doc/luvref.txt`
a2b14ff96dbb181bc967e9f161abd1d2647e6808ddcc53a60000000100000fa0
 `chmod(1)`)
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `permission`: `boolean` or `nil`

                Equivalent to `access(2)` on Unix. Windows uses
                `GetFileAttributesW()`. Access `mode` can be an integer or a
                string containing `"R"` or `"W"` or `"X"`. Returns `true` or
                `false` indicating access permission.

                Returns (sync version): `boolean` or `fail`

                Returns (async version): `uv_fs_t userdata`

uv.fs_chmod({path}, {mode} [, {callback}])                       *uv.fs_chmod()*

                Parameters:
                - `path`: `string`
                - `mode`: `integer` (octal representation of `chmod(1)` mode,
                  e.g. `tonumber('644', 8)`)
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `success`: `boolean` or `nil`

                Equivalent to `chmod(2)`.

                Returns (sync version): `boolean` or `fail`

                Returns (async version): `uv_fs_t userdata`

uv.fs_fchmod({fd}, {mode} [, {callback}])                       *uv.fs_fchmod()*

                Parameters:
                - `fd`: `integer`
                - `mode`: `integer`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `success`: `boolean` or `nil`

                Equivalent to `fchmod(2)`.

                Returns (sync version): `boolean` or `fail`

                Returns (async version): `uv_fs_t userdata`

uv.fs_utime({path} [, {atime}, {mtime}, {callback}])             *uv.fs_utime()*

                Parameters:
                - `path`: `string`
                - `atime`: `number` or `string` or `nil`
                - `mtime`: `number` or `string` or `nil`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `success`: `boolean` or `nil`

                Equivalent to `utime(2)`.

                See |luv-constants| for supported FS Modification Time
                constants.

                Passing `"now"` or `uv.constants.FS_UTIME_NOW` as the atime or
                mtime sets the timestamp to the current time.

                Passing `nil`, `"omit"`, or `uv.constants.FS_UTIME_OMIT` as
                the atime or mtime leaves the timestamp untouched.

                Returns (sync version): `boolean` or `fail`

                Returns (async version): `uv_fs_t userdata`

uv.fs_futime({fd} [, {atime}, {mtime}, {callback}])             *uv.fs_futime()*

                Parameters:
                - `fd`: `integer`
                - `atime`: `number` or `string` or `nil`
                - `mtime`: `number` or `string` or `nil`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `success`: `boolean` or `nil`

                Equivalent to `futimes(3)`.

                See |luv-constants| for supported FS Modification Time
                constants.

                Passing `"now"` or `uv.constants.FS_UTIME_NOW` as the atime or
                mtime sets the timestamp to the current time.

                Passing `nil`, `"omit"`, or `uv.constants.FS_UTIME_OMIT` as
                the atime or mtime leaves the timestamp untouched.

                Returns (sync version): `boolean` or `fail`

                Returns (async version): `uv_fs_t userdata`

uv.fs_lutime({path} [, {atime}, {mtime}, {callback}])           *uv.fs_lutime()*

                Parameters:
                - `path`: `string`
                - `atime`: `number` or `string` or `nil`
              

Title: File Permissions and Timestamps: Chmod, Fchmod, Utime, Futime, Lutime
Summary
This section details functions related to file permissions and timestamp manipulation in libuv. It describes `uv.fs_chmod()` (change file permissions by path), `uv.fs_fchmod()` (change file permissions by file descriptor), `uv.fs_utime()` (change file access and modification times by path), `uv.fs_futime()` (change file access and modification times by file descriptor), and `uv.fs_lutime()` (change file access and modification times of a symbolic link). For each function, the parameters, return values for both synchronous and asynchronous versions, and equivalent POSIX functions are outlined (e.g., `chmod(2)`, `fchmod(2)`, `utime(2)`, `futimes(3)`). The utime functions allow setting timestamps to the current time or omitting changes.