Home Explore Blog CI



neovim

38th chunk of `runtime/doc/luvref.txt`
4bf7fd6f51f59def1f6a6b9863c425dfba347afbeaaed8f50000000100000fa3
 `integer` or `fail`

                Returns (async version): `uv_fs_t userdata`

                Note: On Windows, libuv uses `CreateFileW` and thus the file
                is always opened in binary mode. Because of this, the
                `O_BINARY` and `O_TEXT` flags are not supported.

uv.fs_read({fd}, {size} [, {offset} [, {callback}]])              *uv.fs_read()*

                Parameters:
                - `fd`: `integer`
                - `size`: `integer`
                - `offset`: `integer` or `nil`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `data`: `string` or `nil`

                Equivalent to `preadv(2)`. Returns any data. An empty string
                indicates EOF.

                If `offset` is nil or omitted, it will default to `-1`, which
                indicates "use and update the current file offset."

                Note: When `offset` is >= 0, the current file offset will not
                be updated by the read.

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

                Returns (async version): `uv_fs_t userdata`

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

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

                Equivalent to `unlink(2)`.

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

                Returns (async version): `uv_fs_t userdata`

uv.fs_write({fd}, {data} [, {offset} [, {callback}]])            *uv.fs_write()*

                Parameters:
                - `fd`: `integer`
                - `data`: `buffer`
                - `offset`: `integer` or `nil`
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `err`: `nil` or `string`
                  - `bytes`: `integer` or `nil`

                Equivalent to `pwritev(2)`. Returns the number of bytes
                written.

                If `offset` is nil or omitted, it will default to `-1`, which
                indicates "use and update the current file offset."

                Note: When `offset` is >= 0, the current file offset will not
                be updated by the write.

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

                Returns (async version): `uv_fs_t userdata`

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

                Parameters:
                - `path`: `string`
                - `mode`: `integer` (octal representation of `chmod(1)` mode,
                  e.g. `tonumber('755', 8)`)
                - `callback`: `callable` (async version) or `nil` (sync
                  version)
                  - `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)

Title: File System Operations: More Core Functions
Summary
This section continues detailing file system operations in libuv, specifically describing the functions: `uv.fs_unlink()`, `uv.fs_write()`, `uv.fs_mkdir()`, `uv.fs_mkdtemp()`, and `uv.fs_mkstemp()`. For each, it outlines their parameters, return values, equivalence to standard C library functions (like `unlink(2)`, `pwritev(2)`, `mkdir(2)`, `mkdtemp(3)`), and behavior including handling of synchronous and asynchronous operations.