Home Explore Blog CI



neovim

39th chunk of `runtime/doc/luvref.txt`
8c3485a70dc5b76159d319640004ed48434f71e36d0411f40000000100000fa6
    - `err`: `nil` or `string`
                  - `success`: `boolean` or `nil`

                Equivalent to `mkdir(2)`.

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

                Returns (async version): `uv_fs_t userdata`

uv.fs_mkdtemp({template} [, {callback}])                       *uv.fs_mkdtemp()*

                Parameters:
                - `template`: `string`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `path`: `string` or `nil`

                Equivalent to `mkdtemp(3)`.

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

                Returns (async version): `uv_fs_t userdata`

uv.fs_mkstemp({template} [, {callback}])                       *uv.fs_mkstemp()*

                Parameters:
                - `template`: `string`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `fd`: `integer` or `nil`
                  - `path`: `string` or `nil`

                Equivalent to `mkstemp(3)`. Returns a temporary file handle
                and filename.

                Returns (sync version): `integer, string` or `fail`

                Returns (async version): `uv_fs_t userdata`

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

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

                Equivalent to `rmdir(2)`.

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

                Returns (async version): `uv_fs_t userdata`

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

                Parameters:
                - `path`: `string`
                - `callback`: `callable`
                  - `err`: `nil` or `string`
                  - `success`: `uv_fs_t userdata` or `nil`

                Equivalent to `scandir(3)`, with a slightly different API.
                Returns a handle that the user can pass to
                |uv.fs_scandir_next()|.

                Note: This function can be used synchronously or
                asynchronously. The request userdata is always synchronously
                returned regardless of whether a callback is provided and the
                same userdata is passed to the callback if it is provided.

                Returns: `uv_fs_t userdata` or `fail`

uv.fs_scandir_next({fs})                                  *uv.fs_scandir_next()*

                Parameters:
                - `fs`: `uv_fs_t userdata`

                Called on a |uv_fs_t| returned by |uv.fs_scandir()| to get the
                next directory entry data as a `name, type` pair. When there
                are no more entries, `nil` is returned.

                Note: This function only has a synchronous version. See
                |uv.fs_opendir()| and its related functions for an
                asynchronous version.

                Returns: `string, string` or `nil` or `fail`

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

                Parameters:
                - `path`: `string`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `stat`: `table` or `nil` (see below)

                Equivalent to `stat(2)`.

                Returns (sync version): `table` or `fail`
                - `dev` : `integer`
                - `mode` : `integer`
                - `nlink` : `integer`
                - `uid` : `integer`
                - `gid` : `integer`
                - `rdev` : `integer`
                - `ino` : `integer`

Title: File System Operations: Temporary Files, Directory Management, and Metadata
Summary
This section details more file system operations in libuv, specifically describing the functions: `uv.fs_mkstemp()`, `uv.fs_rmdir()`, `uv.fs_scandir()`, `uv.fs_scandir_next()`, and `uv.fs_stat()`. For each, it outlines their parameters, return values, equivalence to standard C library functions (like `mkstemp(3)`, `rmdir(2)`, `scandir(3)`, `stat(2)`), and behavior including handling of synchronous and asynchronous operations. It also covers how to retrieve directory entries and file metadata.