*luvref.txt*               Nvim


==============================================================================
Luv reference manual                                                    *luvref*

                                                        *luv* *luv-intro* *uv*
This file documents the Lua bindings for the LibUV library which is used for
Nvim's event-loop and is accessible from Lua via |vim.uv| (e.g., |uv.version()|
is exposed as `vim.uv.version()`).

For the examples below, replace `require("luv")` with `vim.uv` and omit
`uv.run()` in Nvim.

For information about this manual, see |luv-credits|.

For further examples, see https://github.com/luvit/luv/tree/master/examples.

                                                                   *luv-credits*
Luv is licensed under the Apache License, Version 2.0:
https://github.com/luvit/luv/blob/master/LICENSE.txt
Copyright 2014 The Luvit Authors. All Rights Reserved.

Based on https://github.com/nanotee/luv-vimdocs with kind permission.

==============================================================================
LibUV in Lua                                                *luv-libuv-in-lua*

The luv (https://github.com/luvit/luv) project provides access to the
multi-platform support library libuv (https://github.com/libuv/libuv) in Lua
code. It was primarily developed for the luvit
(https://github.com/luvit/luvit) project as the built-in `uv` module, but can
be used in other Lua environments.

More information about the core libuv library can be found at the original
libuv documentation page (https://docs.libuv.org/).

==============================================================================
TCP Echo Server Example                          *luv-tcp-echo-server-example*

Here is a small example showing a TCP echo server: >lua
    local uv = require("luv") -- "luv" when stand-alone, "uv" in luvi apps

    local server = uv.new_tcp()
    assert(server:bind("127.0.0.1", 1337))
    server:listen(128, function (err)
      assert(not err, err)
      local client = uv.new_tcp()
      server:accept(client)
      client:read_start(function (err, chunk)
        assert(not err, err)
        if chunk then
          client:write(chunk)
        else
          client:shutdown()
          client:close()
        end
      end)
    end)
    print("TCP server listening at 127.0.0.1 port 1337")
    uv.run() -- an explicit run call is necessary outside of luvit
<

==============================================================================
Module Layout                                              *luv-module-layout*

The luv library contains a single Lua module referred to hereafter as `uv` for
simplicity. This module consists mostly of functions with names corresponding
to their original libuv versions. For example, the libuv function
`uv_tcp_bind` has a luv version at `uv.tcp_bind`. Currently, only two
non-function fields exists: `uv.constants` and `uv.errno`, which are tables.

==============================================================================
Functions vs Methods                                *luv-functions-vs-methods*

In addition to having simple functions, luv provides an optional method-style
API. For example, `uv.tcp_bind(server, host, port)` can alternatively be
called as `server:bind(host, port)`. Note that the first argument `server`
becomes the object and `tcp_` is removed from the function name. Method forms
are documented below where they exist.

==============================================================================
Synchronous vs Asynchronous Functions *luv-synchronous-vs-asynchronous-functions*

Functions that accept a callback are asynchronous. These functions may
immediately return results to the caller to indicate their initial status, but
their final execution is deferred until at least the next libuv loop
iteration. After completion, their callbacks are executed with any results
passed to it.

Functions that do not accept a callback are synchronous. These functions
immediately return their results to the caller.

Some (generally FS and DNS) functions can behave either synchronously or
asynchronously. If a callback is provided to these functions, they behave
asynchronously; if no callback is provided, they behave synchronously.

==============================================================================
Pseudo-Types                                                *luv-pseudo-types*

Some unique types are defined. These are not actual types in Lua, but they are
used here to facilitate documenting consistent behavior:
• `fail`: an assertable `nil, string, string` tuple (see |luv-error-handling|)
• `callable`: a `function`; or a `table` or `userdata` with a `__call`
  metamethod
• `buffer`: a `string` or a sequential `table` of `string`s
• `threadargs`: variable arguments (`...`) of type `nil`, `boolean`, `number`,
  `string`, or `userdata`, numbers of argument limited to 9.

==============================================================================
Contents                                                        *luv-contents*

This documentation is mostly a retelling of the libuv API documentation
(https://docs.libuv.org/en/v1.x/api.html) within the context of luv's Lua API.
Low-level implementation details and unexposed C functions and types are not
documented here except for when they are relevant to behavior seen in the Lua
module.
• |luv-constants|
• |luv-error-handling|
• |luv-version-checking|
• |uv_loop_t| — Event loop
• |uv_req_t| — Base request
• |uv_handle_t| — Base handle
  • |uv_timer_t| — Timer handle
  • |uv_prepare_t| — Prepare handle
  • |uv_check_t| — Check handle
  • |uv_idle_t| — Idle handle
  • |uv_async_t| — Async handle
  • |uv_poll_t| — Poll handle
  • |uv_signal_t| — Signal handle
  • |uv_process_t| — Process handle
  • |uv_stream_t| — Stream handle
    • |uv_tcp_t| — TCP handle
    • |uv_pipe_t| — Pipe handle
    • |uv_tty_t| — TTY handle
  • |uv_udp_t| — UDP handle
  • |uv_fs_event_t| — FS Event handle
  • |uv_fs_poll_t| — FS Poll handle
• |luv-file-system-operations|
• |luv-thread-pool-work-scheduling|
• |luv-dns-utility-functions|
• |luv-threading-and-synchronization-utilities|
• |luv-miscellaneous-utilities|
• |luv-metrics-operations|

==============================================================================
Constants                                                      *luv-constants*

As a Lua library, luv supports and encourages the use of lowercase strings to
represent options. For example: >lua
    -- signal start with string input
    uv.signal_start("sigterm", function(signame)
      print(signame) -- string output: "sigterm"
    end)
<

However, luv also superficially exposes libuv constants in a Lua table at
`uv.constants` where its keys are uppercase constant names and their
associated values are numbers defined internally by libuv. The values from
this table may be supported as function arguments, but their use may not
change the output type. For example: >lua
    -- signal start with integer input
    uv.signal_start(uv.constants.SIGTERM, function(signame)
      print(signame) -- string output: "sigterm"
    end)
<

The uppercase constants defined in `uv.constants` that have associated
lowercase option strings are listed below.

==============================================================================
Address Families                                        *luv-address-families*

uv.constants.AF_APPLETALK                          *uv.constants.AF_APPLETALK*
    (integer)

uv.constants.AF_ATMPVC                                *uv.constants.AF_ATMPVC*
    (integer)

uv.constants.AF_AX25                                    *uv.constants.AF_AX25*
    (integer)

uv.constants.AF_INET                                    *uv.constants.AF_INET*
    (integer)

uv.constants.AF_INET6                                  *uv.constants.AF_INET6*
    (integer)

uv.constants.AF_IPX                                      *uv.constants.AF_IPX*
    (integer)

uv.constants.AF_NETLINK                              *uv.constants.AF_NETLINK*
    (integer)

uv.constants.AF_PACKET                                *uv.constants.AF_PACKET*
    (integer)

uv.constants.AF_UNIX                                    *uv.constants.AF_UNIX*
    (integer)

uv.constants.AF_X25                                      *uv.constants.AF_X25*
    (integer)


==============================================================================
Signals                                                          *luv-signals*

uv.constants.SIGABRT                                    *uv.constants.SIGABRT*
    (integer)

uv.constants.SIGALRM                                    *uv.constants.SIGALRM*
    (integer)

uv.constants.SIGBREAK                                  *uv.constants.SIGBREAK*
    (integer)

uv.constants.SIGBUS                                      *uv.constants.SIGBUS*
    (integer)

uv.constants.SIGCHLD                                    *uv.constants.SIGCHLD*
    (integer)

uv.constants.SIGCONT                                    *uv.constants.SIGCONT*
    (integer)

uv.constants.SIGFPE                                      *uv.constants.SIGFPE*
    (integer)

uv.constants.SIGHUP                                      *uv.constants.SIGHUP*
    (integer)

uv.constants.SIGILL                                      *uv.constants.SIGILL*
    (integer)

uv.constants.SIGINT                                      *uv.constants.SIGINT*
    (integer)

uv.constants.SIGIO                                        *uv.constants.SIGIO*
    (integer)

uv.constants.SIGIOT                                      *uv.constants.SIGIOT*
    (integer)

uv.constants.SIGKILL                                    *uv.constants.SIGKILL*
    (integer)

uv.constants.SIGLOST                                    *uv.constants.SIGLOST*
    (integer)

uv.constants.SIGPIPE                                    *uv.constants.SIGPIPE*
    (integer)

uv.constants.SIGPOLL                                    *uv.constants.SIGPOLL*
    (integer)

uv.constants.SIGPROF                                    *uv.constants.SIGPROF*
    (integer)

uv.constants.SIGPWR                                      *uv.constants.SIGPWR*
    (integer)

uv.constants.SIGQUIT                                    *uv.constants.SIGQUIT*
    (integer)

uv.constants.SIGSEGV                                    *uv.constants.SIGSEGV*
    (integer)

uv.constants.SIGSTKFLT                                *uv.constants.SIGSTKFLT*
    (integer)

uv.constants.SIGSTOP                                    *uv.constants.SIGSTOP*
    (integer)

uv.constants.SIGSYS                                      *uv.constants.SIGSYS*
    (integer)

uv.constants.SIGTERM                                    *uv.constants.SIGTERM*
    (integer)

uv.constants.SIGTRAP                                    *uv.constants.SIGTRAP*
    (integer)

uv.constants.SIGTSTP                                    *uv.constants.SIGTSTP*
    (integer)

uv.constants.SIGTTIN                                    *uv.constants.SIGTTIN*
    (integer)

uv.constants.SIGTTOU                                    *uv.constants.SIGTTOU*
    (integer)

uv.constants.SIGURG                                      *uv.constants.SIGURG*
    (integer)

uv.constants.SIGUSR1                                    *uv.constants.SIGUSR1*
    (integer)

uv.constants.SIGUSR2                                    *uv.constants.SIGUSR2*
    (integer)

uv.constants.SIGVTALRM                                *uv.constants.SIGVTALRM*
    (integer)

uv.constants.SIGWINCH                                  *uv.constants.SIGWINCH*
    (integer)

uv.constants.SIGXCPU                                    *uv.constants.SIGXCPU*
    (integer)

uv.constants.SIGXFSZ                                    *uv.constants.SIGXFSZ*
    (integer)


==============================================================================
Socket Types                                                *luv-socket-types*

uv.constants.SOCK_DGRAM                              *uv.constants.SOCK_DGRAM*
    (integer)

uv.constants.SOCK_RAW                                  *uv.constants.SOCK_RAW*
    (integer)

uv.constants.SOCK_RDM                                  *uv.constants.SOCK_RDM*
    (integer)

uv.constants.SOCK_SEQPACKET                      *uv.constants.SOCK_SEQPACKET*
    (integer)

uv.constants.SOCK_STREAM                            *uv.constants.SOCK_STREAM*
    (integer)


==============================================================================
TTY Modes                                                      *luv-tty-modes*

uv.constants.TTY_MODE_IO                            *uv.constants.TTY_MODE_IO*
    (integer)

uv.constants.TTY_MODE_NORMAL                    *uv.constants.TTY_MODE_NORMAL*
    (integer)

uv.constants.TTY_MODE_RAW                          *uv.constants.TTY_MODE_RAW*
    (integer)

uv.constants.TTY_MODE_RAW_VT                    *uv.constants.TTY_MODE_RAW_VT*
    (integer)


==============================================================================
FS Modification Times                              *luv-fs-modification-times*

uv.constants.FS_UTIME_NOW                          *uv.constants.FS_UTIME_NOW*
    (number)

uv.constants.FS_UTIME_OMIT                        *uv.constants.FS_UTIME_OMIT*
    (number)


==============================================================================
Error Handling                                   *luv-error-handling* *uv.errno*

In libuv, errors are represented by negative numbered constants. While these
constants are made available in the `uv.errno` table, they are not returned by
luv functions and the libuv functions used to handle them are not exposed.
Instead, if an internal error is encountered, the failing luv function will
return to the caller an assertable `nil, err, name` tuple:
• `nil` idiomatically indicates failure
• `err` is a string with the format `{name}: {message}`
  • `{name}` is the error name provided internally by `uv_err_name`
  • `{message}` is a human-readable message provided internally by
    `uv_strerror`
• `name` is the same string used to construct `err`

This tuple is referred to below as the `fail` pseudo-type.

When a function is called successfully, it will return either a value that is
relevant to the operation of the function, or the integer `0` to indicate
success, or sometimes nothing at all. These cases are documented below.

Below is a list of known error names and error strings. See libuv's error
constants (https://docs.libuv.org/en/v1.x/errors.html#error-constants) page
for an original source.

• `E2BIG`: argument list too long.
• `EACCES`: permission denied.
• `EADDRINUSE`: address already in use.
• `EADDRNOTAVAIL`: address not available.
• `EAFNOSUPPORT`: address family not supported.
• `EAGAIN`: resource temporarily unavailable.
• `EAI_ADDRFAMILY`: address family not supported.
• `EAI_AGAIN`: temporary failure.
• `EAI_BADFLAGS`: bad ai_flags value.
• `EAI_BADHINTS`: invalid value for hints.
• `EAI_CANCELED`: request canceled.
• `EAI_FAIL`: permanent failure.
• `EAI_FAMILY`: ai_family not supported.
• `EAI_MEMORY`: out of memory.
• `EAI_NODATA`: no address.
• `EAI_NONAME`: unknown node or service.
• `EAI_OVERFLOW`: argument buffer overflow.
• `EAI_PROTOCOL`: resolved protocol is unknown.
• `EAI_SERVICE`: service not available for socket type.
• `EAI_SOCKTYPE`: socket type not supported.
• `EALREADY`: connection already in progress.
• `EBADF`: bad file descriptor.
• `EBUSY`: resource busy or locked.
• `ECANCELED`: operation canceled.
• `ECHARSET`: invalid Unicode character.
• `ECONNABORTED`: software caused connection abort.
• `ECONNREFUSED`: connection refused.
• `ECONNRESET`: connection reset by peer.
• `EDESTADDRREQ`: destination address required.
• `EEXIST`: file already exists.
• `EFAULT`: bad address in system call argument.
• `EFBIG`: file too large.
• `EHOSTUNREACH`: host is unreachable.
• `EINTR`: interrupted system call.
• `EINVAL`: invalid argument.
• `EIO`: i/o error.
• `EISCONN`: socket is already connected.
• `EISDIR`: illegal operation on a directory.
• `ELOOP`: too many symbolic links encountered.
• `EMFILE`: too many open files.
• `EMSGSIZE`: message too long.
• `ENAMETOOLONG`: name too long.
• `ENETDOWN`: network is down.
• `ENETUNREACH`: network is unreachable.
• `ENFILE`: file table overflow.
• `ENOBUFS`: no buffer space available.
• `ENODEV`: no such device.
• `ENOENT`: no such file or directory.
• `ENOMEM`: not enough memory.
• `ENONET`: machine is not on the network.
• `ENOPROTOOPT`: protocol not available.
• `ENOSPC`: no space left on device.
• `ENOSYS`: function not implemented.
• `ENOTCONN`: socket is not connected.
• `ENOTDIR`: not a directory.
• `ENOTEMPTY`: directory not empty.
• `ENOTSOCK`: socket operation on non-socket.
• `ENOTSUP`: operation not supported on socket.
• `EOVERFLOW`: value too large for defined data type.
• `EPERM`: operation not permitted.
• `EPIPE`: broken pipe.
• `EPROTO`: protocol error.
• `EPROTONOSUPPORT`: protocol not supported.
• `EPROTOTYPE`: protocol wrong type for socket.
• `ERANGE`: result too large.
• `EROFS`: read-only file system.
• `ESHUTDOWN`: cannot send after transport endpoint shutdown.
• `ESPIPE`: invalid seek.
• `ESRCH`: no such process.
• `ETIMEDOUT`: connection timed out.
• `ETXTBSY`: text file is busy.
• `EXDEV`: cross-device link not permitted.
• `UNKNOWN`: unknown error.
• `EOF`: end of file.
• `ENXIO`: no such device or address.
• `EMLINK`: too many links.
• `ENOTTY`: inappropriate ioctl for device.
• `EFTYPE`: inappropriate file type or format.
• `EILSEQ`: illegal byte sequence.
• `ESOCKTNOSUPPORT`: socket type not supported.

==============================================================================
Version Checking                                        *luv-version-checking*

uv.version()                                                    *uv.version()*
    Returns the libuv version packed into a single integer. 8 bits are used
    for each component, with the patch number stored in the 8 least
    significant bits. For example, this would be 0x010203 in libuv 1.2.3.

    Return: ~
        (`integer`)

uv.version_string()                                      *uv.version_string()*
    Returns the libuv version number as a string. For example, this would be
    "1.2.3" in libuv 1.2.3. For non-release versions, the version suffix is
    included.

    Return: ~
        (`string`)


==============================================================================
`uv_loop_t` - Event loop                            *luv-event-loop* *uv_loop_t*

The event loop is the central part of libuv's functionality. It takes care of
polling for I/O and scheduling callbacks to be run based on different sources
of events.

In luv, there is an implicit uv loop for every Lua state that loads the
library. You can use this library in an multi-threaded environment as long as
each thread has it's own Lua state with its corresponding own uv loop. This
loop is not directly exposed to users in the Lua module.


uv.backend_fd()                                              *uv.backend_fd()*
    Get backend file descriptor. Only kqueue, epoll, and event ports are
    supported.

    This can be used in conjunction with `uv.run("nowait")` to poll in one
    thread and run the event loop's callbacks in another Note: Embedding a
    kqueue fd in another kqueue pollset doesn't work on all platforms. It's
    not an error to add the fd but it never generates events.

    Return: ~
        (`integer?`)

uv.backend_timeout()                                    *uv.backend_timeout()*
    Get the poll timeout. The return value is in milliseconds, or -1 for no
    timeout.

    Return: ~
        (`integer`)

uv.loop_alive()                                              *uv.loop_alive()*
    Returns `true` if there are referenced active handles, active requests, or
    closing handles in the loop; otherwise, `false`.

    Return (multiple): ~
        (`boolean?`) alive
        (`string?`) err
        (`uv.error_name?`) err_name

uv.loop_close()                                              *uv.loop_close()*
    Closes all internal loop resources. In normal execution, the loop will
    automatically be closed when it is garbage collected by Lua, so it is not
    necessary to explicitly call `loop_close()`. Call this function only after
    the loop has finished executing and all open handles and requests have
    been closed, or it will return `EBUSY`.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.loop_configure({option}, {...})                       *uv.loop_configure()*
    Set additional loop options. You should normally call this before the
    first call to uv_run() unless mentioned otherwise.

    Supported options:
    • `"block_signal"`: Block a signal when polling for new events. The second
      argument to loop_configure() is the signal name (as a lowercase string)
      or the signal number. This operation is currently only implemented for
      `"sigprof"` signals, to suppress unnecessary wakeups when using a
      sampling profiler. Requesting other signals will fail with `EINVAL`.
    • `"metrics_idle_time"`: Accumulate the amount of idle time the event loop
      spends in the event provider. This option is necessary to use
      `metrics_idle_time()`.

    An example of a valid call to this function is: >lua
        uv.loop_configure("block_signal", "sigprof")
<

    Note: Be prepared to handle the `ENOSYS` error; it means the loop option
    is not supported by the platform.

    Parameters: ~
      • {option}  (`string`)
      • {...}     (`any`) depends on `option`

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.loop_mode()                                                *uv.loop_mode()*
    If the loop is running, returns a string indicating the mode in use. If
    the loop is not running, `nil` is returned instead.

    Return: ~
        (`string?`)

uv.now()                                                            *uv.now()*
    Returns the current timestamp in milliseconds. The timestamp is cached at
    the start of the event loop tick, see `uv.update_time()` for details and
    rationale.

    The timestamp increases monotonically from some arbitrary point in time.
    Don't make assumptions about the starting point, you will only get
    disappointed. Note: Use `uv.hrtime()` if you need sub-millisecond
    granularity.

    Return: ~
        (`integer`)

uv.run({mode})                                                      *uv.run()*
    This function runs the event loop. It will act differently depending on
    the specified mode:
    • `"default"`: Runs the event loop until there are no more active and
      referenced handles or requests. Returns `true` if `uv.stop()` was called
      and there are still active handles or requests. Returns `false` in all
      other cases.
    • `"once"`: Poll for I/O once. Note that this function blocks if there are
      no pending callbacks. Returns `false` when done (no active handles or
      requests left), or `true` if more callbacks are expected (meaning you
      should run the event loop again sometime in the future).
    • `"nowait"`: Poll for I/O once but don't block if there are no pending
      callbacks. Returns `false` if done (no active handles or requests left),
      or `true` if more callbacks are expected (meaning you should run the
      event loop again sometime in the future). Note: Luvit will implicitly
      call `uv.run()` after loading user code, but if you use the luv bindings
      directly, you need to call this after registering your initial set of
      event callbacks to start the event loop.

    Parameters: ~
      • {mode}  (`string?`)

    Return (multiple): ~
        (`boolean?`) running
        (`string?`) err
        (`uv.error_name?`) err_name

uv.stop()                                                          *uv.stop()*
    Stop the event loop, causing `uv.run()` to end as soon as possible. This
    will happen not sooner than the next loop iteration. If this function was
    called before blocking for I/O, the loop won't block for I/O on this
    iteration.

uv.update_time()                                            *uv.update_time()*
    Update the event loop's concept of "now". Libuv caches the current time at
    the start of the event loop tick in order to reduce the number of
    time-related system calls.

    You won't normally need to call this function unless you have callbacks
    that block the event loop for longer periods of time, where "longer" is
    somewhat subjective but probably on the order of a millisecond or more.

uv.walk({callback})                                                *uv.walk()*
    Walk the list of handles: `callback` will be executed with each handle.
    Example >lua
        -- Example usage of uv.walk to close all handles that aren't already closing.
        uv.walk(function (handle)
          if not handle:is_closing() then
            handle:close()
          end
        end)
<

    Parameters: ~
      • {callback}  (`fun(handle: uv.uv_handle_t)`)


==============================================================================
`uv_req_t` - Base request                                   *luv-base-request*

uv.uv_req_t                                           *uv.uv_req_t* *uv_req_t*
    Extends: `userdata`

    `uv_req_t` is the base type for all libuv request types.

    Fields: ~
      • {cancel}    (`fun(self: uv.uv_req_t): 0?, string?, uv.error_name?`)
                    See |uv_req_t:cancel()|.
      • {get_type}  (`fun(self: uv.uv_req_t): string, integer`) See
                    |uv_req_t:get_type()|.

uv.uv_write_t                                     *uv.uv_write_t* *uv_write_t*
    Extends: |uv.uv_req_t|


    Fields: ~
      • {nwritten}  (`fun(self: uv.uv_write_t): integer`) See
                    |uv_write_t:nwritten()|.


uv.cancel({req})                                                 *uv.cancel()*
    Cancel a pending request. Fails if the request is executing or has
    finished executing. Only cancellation of `uv_fs_t`, `uv_getaddrinfo_t`,
    `uv_getnameinfo_t` and `uv_work_t` requests is currently supported.

    Parameters: ~
      • {req}  (`uv.uv_req_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.req_get_type({req})                                     *uv.req_get_type()*
    Returns the name of the struct for a given request (e.g. `"fs"` for
    `uv_fs_t`) and the libuv enum integer for the request's type
    (`uv_req_type`).

    Parameters: ~
      • {req}  (`uv.uv_req_t`)

    Return (multiple): ~
        (`string`) type
        (`integer`) enum

uv.write_nwritten({req})                                 *uv.write_nwritten()*
    Returns the number of bytes written by a `uv_write_t` request. Only valid
    when called from within the write callback (`uv_write_cb`).

    This is primarily useful when a write has been cancelled with
    `uv.cancel()` and the callback receives an `ECANCELED` error, to determine
    how many bytes were actually written before the cancellation took effect.

    Raises an error if `req` is not a write request (`uv_write_t`).

    Parameters: ~
      • {req}  (`uv.uv_write_t`)

    Return: ~
        (`integer`) nwritten

uv_req_t:cancel()                                          *uv_req_t:cancel()*
    Cancel a pending request. Fails if the request is executing or has
    finished executing. Only cancellation of `uv_fs_t`, `uv_getaddrinfo_t`,
    `uv_getnameinfo_t` and `uv_work_t` requests is currently supported.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_req_t:get_type()                                      *uv_req_t:get_type()*
    Returns the name of the struct for a given request (e.g. `"fs"` for
    `uv_fs_t`) and the libuv enum integer for the request's type
    (`uv_req_type`).

    Return (multiple): ~
        (`string`) type
        (`integer`) enum

uv_write_t:nwritten()                                  *uv_write_t:nwritten()*
    Returns the number of bytes written by a `uv_write_t` request. Only valid
    when called from within the write callback (`uv_write_cb`).

    This is primarily useful when a write has been cancelled with
    `uv.cancel()` and the callback receives an `ECANCELED` error, to determine
    how many bytes were actually written before the cancellation took effect.

    Raises an error if `req` is not a write request (`uv_write_t`).

    Return: ~
        (`integer`) nwritten


==============================================================================
`uv_handle_t` - Base handle                                  *luv-base-handle*

uv.uv_handle_t                                  *uv.uv_handle_t* *uv_handle_t*
    Extends: `userdata`

    `uv_handle_t` is the base type for all libuv handle types. All API
    functions defined here work with any handle type.

    Fields: ~
      • {close}             (`fun(self: uv.uv_handle_t, callback: fun()?)`)
                            See |uv_handle_t:close()|.
      • {fileno}            (`fun(self: uv.uv_handle_t): integer?, string?, uv.error_name?`)
                            See |uv_handle_t:fileno()|.
      • {get_type}          (`fun(self: uv.uv_handle_t): string, integer`) See
                            |uv_handle_t:get_type()|.
      • {has_ref}           (`fun(self: uv.uv_handle_t): boolean?, string?, uv.error_name?`)
                            See |uv_handle_t:has_ref()|.
      • {is_active}         (`fun(self: uv.uv_handle_t): boolean?, string?, uv.error_name?`)
                            See |uv_handle_t:is_active()|.
      • {is_closing}        (`fun(self: uv.uv_handle_t): boolean?, string?, uv.error_name?`)
                            See |uv_handle_t:is_closing()|.
      • {recv_buffer_size}  (`fun(self: uv.uv_handle_t, size: integer?): integer?, string?, uv.error_name?`)
                            See |uv_handle_t:recv_buffer_size()|.
      • {ref}               (`fun(self: uv.uv_handle_t)`) See
                            |uv_handle_t:ref()|.
      • {send_buffer_size}  (`fun(self: uv.uv_handle_t, size: integer?): integer?, string?, uv.error_name?`)
                            See |uv_handle_t:send_buffer_size()|.
      • {unref}             (`fun(self: uv.uv_handle_t)`) See
                            |uv_handle_t:unref()|.


uv.close({handle}, {callback})                                    *uv.close()*
    Request handle to be closed. `callback` will be called asynchronously
    after this call. This MUST be called on each handle before memory is
    released.

    Handles that wrap file descriptors are closed immediately but `callback`
    will still be deferred to the next iteration of the event loop. It gives
    you a chance to free up any resources associated with the handle.

    In-progress requests, like `uv_connect_t` or `uv_write_t`, are cancelled
    and have their callbacks called asynchronously with `ECANCELED`.

    Parameters: ~
      • {handle}    (`uv.uv_handle_t`)
      • {callback}  (`fun()?`)

uv.fileno({handle})                                              *uv.fileno()*
    Gets the platform dependent file descriptor equivalent.

    The following handles are supported: TCP, pipes, TTY, UDP and poll.
    Passing any other handle type will fail with `EINVAL`.

    If a handle doesn't have an attached file descriptor yet or the handle
    itself has been closed, this function will return `EBADF`. Warning: Be
    very careful when using this function. libuv assumes it's in control of
    the file descriptor so any change to it may lead to malfunction.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

    Return (multiple): ~
        (`integer?`) fileno
        (`string?`) err
        (`uv.error_name?`) err_name

uv.handle_get_type({handle})                            *uv.handle_get_type()*
    Returns the name of the struct for a given handle (e.g. `"pipe"` for
    `uv_pipe_t`) and the libuv enum integer for the handle's type
    (`uv_handle_type`).

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

    Return (multiple): ~
        (`string`) type
        (`integer`) enum

uv.has_ref({handle})                                            *uv.has_ref()*
    Returns `true` if the handle referenced, `false` if not.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

    Return (multiple): ~
        (`boolean?`) has_ref
        (`string?`) err
        (`uv.error_name?`) err_name

uv.is_active({handle})                                        *uv.is_active()*
    Returns `true` if the handle is active, `false` if it's inactive. What
    "active” means depends on the type of handle:
    • A |uv_async_t| handle is always active and cannot be deactivated, except
      by closing it with `uv.close()`.
    • A |uv_pipe_t|, |uv_tcp_t|, |uv_udp_t|, etc. handle - basically any
      handle that deals with I/O - is active when it is doing something that
      involves I/O, like reading, writing, connecting, accepting new
      connections, etc.
    • A |uv_check_t|, |uv_idle_t|, |uv_timer_t|, etc. handle is active when it
      has been started with a call to `uv.check_start()`, `uv.idle_start()`,
      `uv.timer_start()` etc. until it has been stopped with a call to its
      respective stop function.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

    Return (multiple): ~
        (`boolean?`) active
        (`string?`) err
        (`uv.error_name?`) err_name

uv.is_closing({handle})                                      *uv.is_closing()*
    Returns `true` if the handle is closing or closed, `false` otherwise.
    Note: This function should only be used between the initialization of the
    handle and the arrival of the close callback.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

    Return (multiple): ~
        (`boolean?`) closing
        (`string?`) err
        (`uv.error_name?`) err_name

uv.recv_buffer_size({handle}, {size})                  *uv.recv_buffer_size()*
    Gets or sets the size of the receive buffer that the operating system uses
    for the socket.

    If `size` is omitted (or `0`), this will return the current send buffer
    size; otherwise, this will use `size` to set the new send buffer size.

    This function works for TCP, pipe and UDP handles on Unix and for TCP and
    UDP handles on Windows. Note: Linux will set double the size and return
    double the size of the original set value.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)
      • {size}    (`integer?`)

    Return (multiple): ~
        (`integer?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.ref({handle})                                                    *uv.ref()*
    Reference the given handle. References are idempotent, that is, if a
    handle is already referenced calling this function again will have no
    effect.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

uv.send_buffer_size({handle}, {size})                  *uv.send_buffer_size()*
    Gets or sets the size of the send buffer that the operating system uses
    for the socket.

    If `size` is omitted (or `0`), this will return the current send buffer
    size; otherwise, this will use `size` to set the new send buffer size.

    This function works for TCP, pipe and UDP handles on Unix and for TCP and
    UDP handles on Windows. Note: Linux will set double the size and return
    double the size of the original set value.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)
      • {size}    (`integer?`)

    Return (multiple): ~
        (`integer?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.unref({handle})                                                *uv.unref()*
    Un-reference the given handle. References are idempotent, that is, if a
    handle is not referenced calling this function again will have no effect.

    Parameters: ~
      • {handle}  (`uv.uv_handle_t`)

uv_handle_t:close({callback})                            *uv_handle_t:close()*
    Request handle to be closed. `callback` will be called asynchronously
    after this call. This MUST be called on each handle before memory is
    released.

    Handles that wrap file descriptors are closed immediately but `callback`
    will still be deferred to the next iteration of the event loop. It gives
    you a chance to free up any resources associated with the handle.

    In-progress requests, like `uv_connect_t` or `uv_write_t`, are cancelled
    and have their callbacks called asynchronously with `ECANCELED`.

    Parameters: ~
      • {callback}  (`fun()?`)

uv_handle_t:fileno()                                    *uv_handle_t:fileno()*
    Gets the platform dependent file descriptor equivalent.

    The following handles are supported: TCP, pipes, TTY, UDP and poll.
    Passing any other handle type will fail with `EINVAL`.

    If a handle doesn't have an attached file descriptor yet or the handle
    itself has been closed, this function will return `EBADF`. Warning: Be
    very careful when using this function. libuv assumes it's in control of
    the file descriptor so any change to it may lead to malfunction.

    Return (multiple): ~
        (`integer?`) fileno
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:get_type()                                *uv_handle_t:get_type()*
    Returns the name of the struct for a given handle (e.g. `"pipe"` for
    `uv_pipe_t`) and the libuv enum integer for the handle's type
    (`uv_handle_type`).

    Return (multiple): ~
        (`string`) type
        (`integer`) enum

uv_handle_t:has_ref()                                  *uv_handle_t:has_ref()*
    Returns `true` if the handle referenced, `false` if not.

    Return (multiple): ~
        (`boolean?`) has_ref
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:is_active()                              *uv_handle_t:is_active()*
    Returns `true` if the handle is active, `false` if it's inactive. What
    "active” means depends on the type of handle:
    • A |uv_async_t| handle is always active and cannot be deactivated, except
      by closing it with `uv.close()`.
    • A |uv_pipe_t|, |uv_tcp_t|, |uv_udp_t|, etc. handle - basically any
      handle that deals with I/O - is active when it is doing something that
      involves I/O, like reading, writing, connecting, accepting new
      connections, etc.
    • A |uv_check_t|, |uv_idle_t|, |uv_timer_t|, etc. handle is active when it
      has been started with a call to `uv.check_start()`, `uv.idle_start()`,
      `uv.timer_start()` etc. until it has been stopped with a call to its
      respective stop function.

    Return (multiple): ~
        (`boolean?`) active
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:is_closing()                            *uv_handle_t:is_closing()*
    Returns `true` if the handle is closing or closed, `false` otherwise.
    Note: This function should only be used between the initialization of the
    handle and the arrival of the close callback.

    Return (multiple): ~
        (`boolean?`) closing
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:recv_buffer_size({size})          *uv_handle_t:recv_buffer_size()*
    Gets or sets the size of the receive buffer that the operating system uses
    for the socket.

    If `size` is omitted (or `0`), this will return the current send buffer
    size; otherwise, this will use `size` to set the new send buffer size.

    This function works for TCP, pipe and UDP handles on Unix and for TCP and
    UDP handles on Windows. Note: Linux will set double the size and return
    double the size of the original set value.

    Parameters: ~
      • {size}  (`integer?`)

    Return (multiple): ~
        (`integer?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:ref()                                          *uv_handle_t:ref()*
    Reference the given handle. References are idempotent, that is, if a
    handle is already referenced calling this function again will have no
    effect.

uv_handle_t:send_buffer_size({size})          *uv_handle_t:send_buffer_size()*
    Gets or sets the size of the send buffer that the operating system uses
    for the socket.

    If `size` is omitted (or `0`), this will return the current send buffer
    size; otherwise, this will use `size` to set the new send buffer size.

    This function works for TCP, pipe and UDP handles on Unix and for TCP and
    UDP handles on Windows. Note: Linux will set double the size and return
    double the size of the original set value.

    Parameters: ~
      • {size}  (`integer?`)

    Return (multiple): ~
        (`integer?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_handle_t:unref()                                      *uv_handle_t:unref()*
    Un-reference the given handle. References are idempotent, that is, if a
    handle is not referenced calling this function again will have no effect.


==============================================================================
Reference counting                                    *luv-reference-counting*

The libuv event loop (if run in the default mode) will run until there are no
active and referenced handles left. The user can force the loop to exit early
by unreferencing handles which are active, for example by calling `uv.unref()`
after calling `uv.timer_start()`.

A handle can be referenced or unreferenced, the refcounting scheme doesn't use
a counter, so both operations are idempotent.

All handles are referenced when active by default, see `uv.is_active()` for a
more detailed explanation on what being active involves.

==============================================================================
`uv_timer_t` - Timer handle                                 *luv-timer-handle*

uv.uv_timer_t                                     *uv.uv_timer_t* *uv_timer_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Timer handles are used to schedule callbacks to be called in the future.

    Fields: ~
      • {again}       (`fun(self: uv.uv_timer_t): 0?, string?, uv.error_name?`)
                      See |uv_timer_t:again()|.
      • {get_due_in}  (`fun(self: uv.uv_timer_t): integer`) See
                      |uv_timer_t:get_due_in()|.
      • {get_repeat}  (`fun(self: uv.uv_timer_t): integer`) See
                      |uv_timer_t:get_repeat()|.
      • {set_repeat}  (`fun(self: uv.uv_timer_t, repeat_: integer)`) See
                      |uv_timer_t:set_repeat()|.
      • {start}       (`fun(self: uv.uv_timer_t, timeout: integer, repeat_: integer, callback: fun()): 0?, string?, uv.error_name?`)
                      See |uv_timer_t:start()|.
      • {stop}        (`fun(self: uv.uv_timer_t): 0?, string?, uv.error_name?`)
                      See |uv_timer_t:stop()|.


uv.new_timer()                                                *uv.new_timer()*
    Creates and initializes a new `uv_timer_t`. Returns the Lua userdata
    wrapping it. Example >lua
        -- Creating a simple setTimeout wrapper
        local function setTimeout(timeout, callback)
          local timer = uv.new_timer()
          timer:start(timeout, 0, function ()
            timer:stop()
            timer:close()
            callback()
          end)
          return timer
        end

        -- Creating a simple setInterval wrapper
        local function setInterval(interval, callback)
          local timer = uv.new_timer()
          timer:start(interval, interval, function ()
            callback()
          end)
          return timer
        end

        -- And clearInterval
        local function clearInterval(timer)
          timer:stop()
          timer:close()
        end
<

    Return (multiple): ~
        (`uv.uv_timer_t?`) timer
        (`string?`) err
        (`uv.error_name?`) err_name

uv.timer_again({timer})                                     *uv.timer_again()*
    Stop the timer, and if it is repeating restart it using the repeat value
    as the timeout. If the timer has never been started before it raises
    `EINVAL`.

    Parameters: ~
      • {timer}  (`uv.uv_timer_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.timer_get_due_in({timer})                           *uv.timer_get_due_in()*
    Get the timer due value or 0 if it has expired. The time is relative to
    `uv.now()`.

    Parameters: ~
      • {timer}  (`uv.uv_timer_t`)

    Return: ~
        (`integer`) due_in

uv.timer_get_repeat({timer})                           *uv.timer_get_repeat()*
    Get the timer repeat value.

    Parameters: ~
      • {timer}  (`uv.uv_timer_t`)

    Return: ~
        (`integer`) repeat_

uv.timer_set_repeat({timer}, {repeat_})                *uv.timer_set_repeat()*
    Set the repeat interval value in milliseconds. The timer will be scheduled
    to run on the given interval, regardless of the callback execution
    duration, and will follow normal timer semantics in the case of a
    time-slice overrun.

    For example, if a 50 ms repeating timer first runs for 17 ms, it will be
    scheduled to run again 33 ms later. If other tasks consume more than the
    33 ms following the first timer callback, then the callback will run as
    soon as possible.

    Parameters: ~
      • {timer}    (`uv.uv_timer_t`)
      • {repeat_}  (`integer`)

uv.timer_start({timer}, {timeout}, {repeat_}, {callback})   *uv.timer_start()*
    Start the timer. `timeout` and `repeat` are in milliseconds.

    If `timeout` is zero, the callback fires on the next event loop iteration.
    If `repeat` is non-zero, the callback fires first after `timeout`
    milliseconds and then repeatedly after `repeat` milliseconds.

    Parameters: ~
      • {timer}     (`uv.uv_timer_t`)
      • {timeout}   (`integer`)
      • {repeat_}   (`integer`)
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.timer_stop({timer})                                       *uv.timer_stop()*
    Stop the timer, the callback will not be called anymore.

    Parameters: ~
      • {timer}  (`uv.uv_timer_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_timer_t:again()                                        *uv_timer_t:again()*
    Stop the timer, and if it is repeating restart it using the repeat value
    as the timeout. If the timer has never been started before it raises
    `EINVAL`.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_timer_t:get_due_in()                              *uv_timer_t:get_due_in()*
    Get the timer due value or 0 if it has expired. The time is relative to
    `uv.now()`.

    Return: ~
        (`integer`) due_in

uv_timer_t:get_repeat()                              *uv_timer_t:get_repeat()*
    Get the timer repeat value.

    Return: ~
        (`integer`) repeat_

uv_timer_t:set_repeat({repeat_})                     *uv_timer_t:set_repeat()*
    Set the repeat interval value in milliseconds. The timer will be scheduled
    to run on the given interval, regardless of the callback execution
    duration, and will follow normal timer semantics in the case of a
    time-slice overrun.

    For example, if a 50 ms repeating timer first runs for 17 ms, it will be
    scheduled to run again 33 ms later. If other tasks consume more than the
    33 ms following the first timer callback, then the callback will run as
    soon as possible.

    Parameters: ~
      • {repeat_}  (`integer`)

uv_timer_t:start({timeout}, {repeat_}, {callback})        *uv_timer_t:start()*
    Start the timer. `timeout` and `repeat` are in milliseconds.

    If `timeout` is zero, the callback fires on the next event loop iteration.
    If `repeat` is non-zero, the callback fires first after `timeout`
    milliseconds and then repeatedly after `repeat` milliseconds.

    Parameters: ~
      • {timeout}   (`integer`)
      • {repeat_}   (`integer`)
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_timer_t:stop()                                          *uv_timer_t:stop()*
    Stop the timer, the callback will not be called anymore.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_prepare_t` - Prepare handle                           *luv-prepare-handle*

uv.uv_prepare_t                               *uv.uv_prepare_t* *uv_prepare_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Prepare handles will run the given callback once per loop iteration, right
    before polling for I/O. >lua
        local prepare = uv.new_prepare()
        prepare:start(function()
          print("Before I/O polling")
        end)
<

    Fields: ~
      • {start}  (`fun(self: uv.uv_prepare_t, callback: fun()): 0?, string?, uv.error_name?`)
                 See |uv_prepare_t:start()|.
      • {stop}   (`fun(self: uv.uv_prepare_t): 0?, string?, uv.error_name?`)
                 See |uv_prepare_t:stop()|.


uv.new_prepare()                                            *uv.new_prepare()*
    Creates and initializes a new `uv_prepare_t`. Returns the Lua userdata
    wrapping it.

    Return: ~
        (`uv.uv_prepare_t`)

uv.prepare_start({prepare}, {callback})                   *uv.prepare_start()*
    Start the handle with the given callback.

    Parameters: ~
      • {prepare}   (`uv.uv_prepare_t`)
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.prepare_stop({prepare})                                 *uv.prepare_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {prepare}  (`uv.uv_prepare_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_prepare_t:start({callback})                          *uv_prepare_t:start()*
    Start the handle with the given callback.

    Parameters: ~
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_prepare_t:stop()                                      *uv_prepare_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_check_t` - Check handle                                 *luv-check-handle*

uv.uv_check_t                                     *uv.uv_check_t* *uv_check_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Check handles will run the given callback once per loop iteration, right
    after polling for I/O. >lua
        local check = uv.new_check()
        check:start(function()
          print("After I/O polling")
        end)
<

    Fields: ~
      • {start}  (`fun(self: uv.uv_check_t, callback: fun()): 0?, string?, uv.error_name?`)
                 See |uv_check_t:start()|.
      • {stop}   (`fun(self: uv.uv_check_t): 0?, string?, uv.error_name?`) See
                 |uv_check_t:stop()|.


uv.check_start({check}, {callback})                         *uv.check_start()*
    Start the handle with the given callback.

    Parameters: ~
      • {check}     (`uv.uv_check_t`)
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.check_stop({check})                                       *uv.check_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {check}  (`uv.uv_check_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_check()                                                *uv.new_check()*
    Creates and initializes a new `uv_check_t`. Returns the Lua userdata
    wrapping it.

    Return: ~
        (`uv.uv_check_t`)

uv_check_t:start({callback})                              *uv_check_t:start()*
    Start the handle with the given callback.

    Parameters: ~
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_check_t:stop()                                          *uv_check_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_idle_t` - Idle handle                                    *luv-idle-handle*

uv.uv_idle_t                                        *uv.uv_idle_t* *uv_idle_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Idle handles will run the given callback once per loop iteration, right
    before the |uv_prepare_t| handles.

    Note: The notable difference with prepare handles is that when there are
    active idle handles, the loop will perform a zero timeout poll instead of
    blocking for I/O.

    Warning: Despite the name, idle handles will get their callbacks called on
    every loop iteration, not when the loop is actually "idle". >lua
        local idle = uv.new_idle()
        idle:start(function()
          print("Before I/O polling, no blocking")
        end)
<

    Fields: ~
      • {start}  (`fun(self: uv.uv_idle_t, callback: fun()): 0?, string?, uv.error_name?`)
                 See |uv_idle_t:start()|.
      • {stop}   (`fun(self: uv.uv_idle_t): 0?, string?, uv.error_name?`) See
                 |uv_idle_t:stop()|.


uv.idle_start({idle}, {callback})                            *uv.idle_start()*
    Start the handle with the given callback.

    Parameters: ~
      • {idle}      (`uv.uv_idle_t`)
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.idle_stop({idle})                                          *uv.idle_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {idle}  (`uv.uv_idle_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_idle()                                                  *uv.new_idle()*
    Creates and initializes a new `uv_idle_t`. Returns the Lua userdata
    wrapping it.

    Return: ~
        (`uv.uv_idle_t`)

uv_idle_t:start({callback})                                *uv_idle_t:start()*
    Start the handle with the given callback.

    Parameters: ~
      • {callback}  (`fun()`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_idle_t:stop()                                            *uv_idle_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_async_t` - Async handle                                 *luv-async-handle*

uv.uv_async_t                                     *uv.uv_async_t* *uv_async_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Async handles allow the user to "wakeup" the event loop and get a callback
    called from another thread. >lua
        local async
        async = uv.new_async(function()
          print("async operation ran")
          async:close()
        end)

        async:send()
<

    Fields: ~
      • {send}  (`fun(self: uv.uv_async_t, ...: uv.threadargs): 0?, string?, uv.error_name?`)
                See |uv_async_t:send()|.


uv.async_send({async}, {...})                                *uv.async_send()*
    Wakeup the event loop and call the async handle's callback. Note: It's
    safe to call this function from any thread. The callback will be called on
    the loop thread. Warning: libuv will coalesce calls to
    `uv.async_send(async)`, that is, not every call to it will yield an
    execution of the callback. For example: if `uv.async_send()` is called 5
    times in a row before the callback is called, the callback will only be
    called once. If `uv.async_send()` is called again after the callback was
    called, it will be called again.

    Parameters: ~
      • {async}  (`uv.uv_async_t`)
      • {...}    (`uv.threadargs`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_async({callback})                                      *uv.new_async()*
    Creates and initializes a new `uv_async_t`. Returns the Lua userdata
    wrapping it. Note: Unlike other handle initialization functions, this
    immediately starts the handle.

    Parameters: ~
      • {callback}  (`fun(...: uv.threadargs)`)

    Return (multiple): ~
        (`uv.uv_async_t?`) async
        (`string?`) err
        (`uv.error_name?`) err_name

uv_async_t:send({...})                                     *uv_async_t:send()*
    Wakeup the event loop and call the async handle's callback. Note: It's
    safe to call this function from any thread. The callback will be called on
    the loop thread. Warning: libuv will coalesce calls to
    `uv.async_send(async)`, that is, not every call to it will yield an
    execution of the callback. For example: if `uv.async_send()` is called 5
    times in a row before the callback is called, the callback will only be
    called once. If `uv.async_send()` is called again after the callback was
    called, it will be called again.

    Parameters: ~
      • {...}  (`uv.threadargs`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_poll_t` - Poll handle                                    *luv-poll-handle*

uv.uv_poll_t                                        *uv.uv_poll_t* *uv_poll_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Poll handles are used to watch file descriptors for readability and
    writability, similar to the purpose of poll(2)
    (https://linux.die.net/man/2/poll).

    The purpose of poll handles is to enable integrating external libraries
    that rely on the event loop to signal it about the socket status changes,
    like c-ares or libssh2. Using `uv_poll_t` for any other purpose is not
    recommended; `uv_tcp_t`, `uv_udp_t`, etc. provide an implementation that
    is faster and more scalable than what can be achieved with `uv_poll_t`,
    especially on Windows.

    It is possible that poll handles occasionally signal that a file
    descriptor is readable or writable even when it isn't. The user should
    therefore always be prepared to handle EAGAIN or equivalent when it
    attempts to read from or write to the fd.

    It is not okay to have multiple active poll handles for the same socket,
    this can cause libuv to busyloop or otherwise malfunction.

    The user should not close a file descriptor while it is being polled by an
    active poll handle. This can cause the handle to report an error, but it
    might also start polling another socket. However the fd can be safely
    closed immediately after a call to `uv.poll_stop()` or `uv.close()`.

    Note: On windows only sockets can be polled with poll handles. On Unix any
    file descriptor that would be accepted by poll(2) can be used.

    Fields: ~
      • {start}  (`fun(self: uv.uv_poll_t, events: string?, callback: fun(err: string?, events: string?)): 0?, string?, uv.error_name?`)
                 See |uv_poll_t:start()|.
      • {stop}   (`fun(self: uv.uv_poll_t): 0?, string?, uv.error_name?`) See
                 |uv_poll_t:stop()|.


uv.new_poll({fd})                                              *uv.new_poll()*
    Initialize the handle using a file descriptor.

    The file descriptor is set to non-blocking mode.

    Parameters: ~
      • {fd}  (`integer`)

    Return (multiple): ~
        (`uv.uv_poll_t?`) poll
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_socket_poll({fd})                                *uv.new_socket_poll()*
    Initialize the handle using a socket descriptor. On Unix this is identical
    to `uv.new_poll()`. On windows it takes a SOCKET handle.

    The socket is set to non-blocking mode.

    Parameters: ~
      • {fd}  (`integer`)

    Return (multiple): ~
        (`uv.uv_poll_t?`) poll
        (`string?`) err
        (`uv.error_name?`) err_name

uv.poll_start({poll}, {events}, {callback})                  *uv.poll_start()*
    Starts polling the file descriptor. `events` are: `"r"`, `"w"`, `"rw"`,
    `"d"`, `"rd"`, `"wd"`, `"rwd"`, `"p"`, `"rp"`, `"wp"`, `"rwp"`, `"dp"`,
    `"rdp"`, `"wdp"`, or `"rwdp"` where `r` is `READABLE`, `w` is `WRITABLE`,
    `d` is `DISCONNECT`, and `p` is `PRIORITIZED`. As soon as an event is
    detected the callback will be called with status set to 0, and the
    detected events set on the events field.

    The user should not close the socket while the handle is active. If the
    user does that anyway, the callback may be called reporting an error
    status, but this is not guaranteed. Note: Calling `uv.poll_start()` on a
    handle that is already active is fine. Doing so will update the events
    mask that is being watched for.

    Parameters: ~
      • {poll}      (`uv.uv_poll_t`)
      • {events}    (`string?`)
      • {callback}  (`fun(err: string?, events: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.poll_stop({poll})                                          *uv.poll_stop()*
    Stop polling the file descriptor, the callback will no longer be called.

    Parameters: ~
      • {poll}  (`uv.uv_poll_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_poll_t:start({events}, {callback})                      *uv_poll_t:start()*
    Starts polling the file descriptor. `events` are: `"r"`, `"w"`, `"rw"`,
    `"d"`, `"rd"`, `"wd"`, `"rwd"`, `"p"`, `"rp"`, `"wp"`, `"rwp"`, `"dp"`,
    `"rdp"`, `"wdp"`, or `"rwdp"` where `r` is `READABLE`, `w` is `WRITABLE`,
    `d` is `DISCONNECT`, and `p` is `PRIORITIZED`. As soon as an event is
    detected the callback will be called with status set to 0, and the
    detected events set on the events field.

    The user should not close the socket while the handle is active. If the
    user does that anyway, the callback may be called reporting an error
    status, but this is not guaranteed. Note: Calling `uv.poll_start()` on a
    handle that is already active is fine. Doing so will update the events
    mask that is being watched for.

    Parameters: ~
      • {events}    (`string?`)
      • {callback}  (`fun(err: string?, events: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_poll_t:stop()                                            *uv_poll_t:stop()*
    Stop polling the file descriptor, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_signal_t` - Signal handle                              *luv-signal-handle*

uv.uv_signal_t                                  *uv.uv_signal_t* *uv_signal_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Signal handles implement Unix style signal handling on a per-event loop
    bases.

    Windows Notes:

    Reception of some signals is emulated on Windows:
    • SIGINT is normally delivered when the user presses CTRL+C. However, like
      on Unix, it is not generated when terminal raw mode is enabled.
    • SIGBREAK is delivered when the user pressed CTRL + BREAK.
    • SIGHUP is generated when the user closes the console window. On SIGHUP
      the program is given approximately 10 seconds to perform cleanup. After
      that Windows will unconditionally terminate it.
    • SIGWINCH is raised whenever libuv detects that the console has been
      resized. SIGWINCH is emulated by libuv when the program uses a uv_tty_t
      handle to write to the console. SIGWINCH may not always be delivered in
      a timely manner; libuv will only detect size changes when the cursor is
      being moved. When a readable |uv_tty_t| handle is used in raw mode,
      resizing the console buffer will also trigger a SIGWINCH signal.
    • Watchers for other signals can be successfully created, but these
      signals are never received. These signals are: SIGILL, SIGABRT, SIGFPE,
      SIGSEGV, SIGTERM and SIGKILL.
    • Calls to raise() or abort() to programmatically raise a signal are not
      detected by libuv; these will not trigger a signal watcher.

    Unix Notes:
    • SIGKILL and SIGSTOP are impossible to catch.
    • Handling SIGBUS, SIGFPE, SIGILL or SIGSEGV via libuv results into
      undefined behavior.
    • SIGABRT will not be caught by libuv if generated by abort(), e.g.
      through assert().
    • On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL
      pthreads library to manage threads. Installing watchers for those
      signals will lead to unpredictable behavior and is strongly discouraged.
      Future versions of libuv may simply reject them. >lua
        -- Create a new signal handler
        local signal = uv.new_signal()
        -- Define a handler function
        uv.signal_start(signal, "sigint", function(signame)
          print("got " .. signame .. ", shutting down")
          os.exit(1)
        end)
<

    Fields: ~
      • {start}          (`fun(self: uv.uv_signal_t, signame: string|integer, callback: fun(signame: string)): 0?, string?, uv.error_name?`)
                         See |uv_signal_t:start()|.
      • {start_oneshot}  (`fun(self: uv.uv_signal_t, signame: string|integer, callback: fun(signame: string)): 0?, string?, uv.error_name?`)
                         See |uv_signal_t:start_oneshot()|.
      • {stop}           (`fun(self: uv.uv_signal_t): 0?, string?, uv.error_name?`)
                         See |uv_signal_t:stop()|.


uv.new_signal()                                              *uv.new_signal()*
    Creates and initializes a new `uv_signal_t`. Returns the Lua userdata
    wrapping it.

    Return (multiple): ~
        (`uv.uv_signal_t?`) signal
        (`string?`) err
        (`uv.error_name?`) err_name

uv.signal_start({signal}, {signame}, {callback})           *uv.signal_start()*
    Start the handle with the given callback, watching for the given signal.

    See |luv-constants| for supported `signame` input and output values.
    String `signame` values are case-insensitive.

    Parameters: ~
      • {signal}    (`uv.uv_signal_t`)
      • {signame}   (`string|integer`)
      • {callback}  (`fun(signame: string)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.signal_start_oneshot({signal}, {signame}, {callback})  *uv.signal_start_oneshot()*
    Same functionality as `uv.signal_start()` but the signal handler is reset
    the moment the signal is received.

    See |luv-constants| for supported `signame` input and output values.
    String `signame` values are case-insensitive.

    Parameters: ~
      • {signal}    (`uv.uv_signal_t`)
      • {signame}   (`string|integer`)
      • {callback}  (`fun(signame: string)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.signal_stop({signal})                                    *uv.signal_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {signal}  (`uv.uv_signal_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_signal_t:start({signame}, {callback})                 *uv_signal_t:start()*
    Start the handle with the given callback, watching for the given signal.

    See |luv-constants| for supported `signame` input and output values.
    String `signame` values are case-insensitive.

    Parameters: ~
      • {signame}   (`string|integer`)
      • {callback}  (`fun(signame: string)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_signal_t:start_oneshot({signame}, {callback})  *uv_signal_t:start_oneshot()*
    Same functionality as `uv.signal_start()` but the signal handler is reset
    the moment the signal is received.

    See |luv-constants| for supported `signame` input and output values.
    String `signame` values are case-insensitive.

    Parameters: ~
      • {signame}   (`string|integer`)
      • {callback}  (`fun(signame: string)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_signal_t:stop()                                        *uv_signal_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_process_t` - Process handle                           *luv-process-handle*

uv.spawn.options                                            *uv.spawn.options*

    Fields: ~
      • {args}          (`string[]?`) Command line arguments as a list of
                        strings. The first string should not be the path to
                        the program, since that is already provided via
                        `path`. On Windows, this uses CreateProcess which
                        concatenates the arguments into a string. This can
                        cause some strange errors (see `options.verbatim`
                        below for Windows).
      • {cwd}           (`string?`) Set the current working directory for the
                        sub-process.
      • {detached}      (`boolean?`) If true, spawn the child process in a
                        detached state - this will make it a process group
                        leader, and will effectively enable the child to keep
                        running after the parent exits. Note that the child
                        process will still keep the parent's event loop alive
                        unless the parent process calls `uv.unref()` on the
                        child's process handle.
      • {env}           (`string[]?`) Set environment variables for the new
                        process. Each entry should be a string in the form of
                        `NAME=VALUE`.
      • {gid}           (`integer?`) Set the child process' group id.
      • {hide}          (`boolean?`) If true, hide the subprocess console
                        window that would normally be created. This option is
                        only meaningful on Windows systems. On Unix it is
                        silently ignored.
      • {hide_console}  (`boolean?`) Hide the subprocess console window on
                        Windows.
      • {hide_gui}      (`boolean?`) Hide the subprocess GUI window on
                        Windows.
      • {stdio}         (`table<integer, integer|uv.uv_stream_t?>?`) Set the
                        file descriptors that will be made available to the
                        child process. The convention is that the first
                        entries are stdin, stdout, and stderr.

                        The entries can take many shapes.
                        • If `integer`, then the child process inherits that
                          same zero-indexed fd from the parent process.
                        • If `uv_stream_t` handles are passed in, those are
                          used as a read-write pipe or inherited stream
                          depending if the stream has a valid fd.
                        • If `nil`, means to ignore that fd in the child
                          process.

                        Note: On Windows, file descriptors after the third are
                        available to the child process only if the child
                        processes uses the MSVCRT runtime.
      • {uid}           (`integer?`) Set the child process' user id.
      • {verbatim}      (`boolean?`) If true, do not wrap any arguments in
                        quotes, or perform any other escaping, when converting
                        the argument list into a command line string. This
                        option is only meaningful on Windows systems. On Unix
                        it is silently ignored.

uv.uv_process_t                               *uv.uv_process_t* *uv_process_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Process handles will spawn a new process and allow the user to control it
    and establish communication channels with it using streams.

    Fields: ~
      • {get_pid}  (`fun(self: uv.uv_process_t): integer`) See
                   |uv_process_t:get_pid()|.
      • {kill}     (`fun(self: uv.uv_process_t, signame: string|integer?): 0?, string?, uv.error_name?`)
                   See |uv_process_t:kill()|.


uv.disable_stdio_inheritance()                *uv.disable_stdio_inheritance()*
    Disables inheritance for file descriptors / handles that this process
    inherited from its parent. The effect is that child processes spawned by
    this process don't accidentally inherit these handles.

    It is recommended to call this function as early in your program as
    possible, before the inherited file descriptors can be closed or
    duplicated. Note: This function works on a best-effort basis: there is no
    guarantee that libuv can discover all file descriptors that were
    inherited. In general it does a better job on Windows than it does on
    Unix.

uv.kill({pid}, {signame})                                          *uv.kill()*
    Sends the specified signal to the given PID. Check the documentation on
    `uv_signal_t` for signal support, specially on Windows.

    See |luv-constants| for supported `signame` input values.

    Parameters: ~
      • {pid}      (`integer`)
      • {signame}  (`string|integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.process_get_pid({process})                           *uv.process_get_pid()*
    Returns the handle's pid.

    Parameters: ~
      • {process}  (`uv.uv_process_t`)

    Return: ~
        (`integer`)

uv.process_kill({process}, {signame})                      *uv.process_kill()*
    Sends the specified signal to the given process handle. Check the
    documentation on `uv_signal_t` for signal support, specially on Windows.

    See |luv-constants| for supported `signame` input values.

    Parameters: ~
      • {process}  (`uv.uv_process_t`)
      • {signame}  (`string|integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.spawn({path}, {options}, {on_exit})                            *uv.spawn()*
    Initializes the process handle and starts the process. If the process is
    successfully spawned, this function will return the handle and pid of the
    child process.

    Possible reasons for failing to spawn would include (but not be limited
    to) the file to execute not existing, not having permissions to use the
    setuid or setgid specified, or not having enough memory to allocate for
    the new process. >lua
        local stdin = uv.new_pipe()
        local stdout = uv.new_pipe()
        local stderr = uv.new_pipe()

        print("stdin", stdin)
        print("stdout", stdout)
        print("stderr", stderr)

        local handle, pid = uv.spawn("cat", {
          stdio = {stdin, stdout, stderr}
        }, function(code, signal) -- on exit
          print("exit code", code)
          print("exit signal", signal)
        end)

        print("process opened", handle, pid)

        uv.read_start(stdout, function(err, data)
          assert(not err, err)
          if data then
            print("stdout chunk", stdout, data)
          else
            print("stdout end", stdout)
          end
        end)

        uv.read_start(stderr, function(err, data)
          assert(not err, err)
          if data then
            print("stderr chunk", stderr, data)
          else
            print("stderr end", stderr)
          end
        end)

        uv.write(stdin, "Hello World")

        uv.shutdown(stdin, function()
          print("stdin shutdown", stdin)
          uv.close(handle, function()
            print("process closed", handle, pid)
          end)
        end)
<

    When the child process exits, `on_exit` is called with an exit code and
    signal.

    Parameters: ~
      • {path}     (`string`)
      • {options}  (`uv.spawn.options`)
      • {on_exit}  (`fun(code: integer, signal: integer)?`)

    Return (multiple): ~
        (`uv.uv_process_t?`) handle
        (`integer|string`) pid_or_err
        (`uv.error_name?`) err_name

uv_process_t:get_pid()                                *uv_process_t:get_pid()*
    Returns the handle's pid.

    Return: ~
        (`integer`)

uv_process_t:kill({signame})                             *uv_process_t:kill()*
    Sends the specified signal to the given process handle. Check the
    documentation on `uv_signal_t` for signal support, specially on Windows.

    See |luv-constants| for supported `signame` input values.

    Parameters: ~
      • {signame}  (`string|integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_stream_t` - Stream handle                              *luv-stream-handle*

uv.uv_stream_t                                  *uv.uv_stream_t* *uv_stream_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    Stream handles provide an abstraction of a duplex communication channel.
    |uv_stream_t| is an abstract type, libuv provides 3 stream implementations
    in the form of |uv_tcp_t|, |uv_pipe_t| and |uv_tty_t|.

    Fields: ~
      • {accept}                (`fun(self: uv.uv_stream_t, client_stream: uv.uv_stream_t): 0?, string?, uv.error_name?`)
                                See |uv_stream_t:accept()|.
      • {get_write_queue_size}  (`fun(self: uv.uv_stream_t): integer`) See
                                |uv_stream_t:get_write_queue_size()|.
      • {is_readable}           (`fun(self: uv.uv_stream_t): boolean`) See
                                |uv_stream_t:is_readable()|.
      • {is_writable}           (`fun(self: uv.uv_stream_t): boolean`) See
                                |uv_stream_t:is_writable()|.
      • {listen}                (`fun(self: uv.uv_stream_t, backlog: integer, callback: fun(err: string?)): 0?, string?, uv.error_name?`)
                                See |uv_stream_t:listen()|.
      • {read_start}            (`fun(self: uv.uv_stream_t, callback: fun(err: string?, data: string?)): 0?, string?, uv.error_name?`)
                                See |uv_stream_t:read_start()|.
      • {read_stop}             (`fun(self: uv.uv_stream_t): 0?, string?, uv.error_name?`)
                                See |uv_stream_t:read_stop()|.
      • {set_blocking}          (`fun(self: uv.uv_stream_t, blocking: boolean): 0?, string?, uv.error_name?`)
                                See |uv_stream_t:set_blocking()|.
      • {shutdown}              (`fun(self: uv.uv_stream_t, callback: fun(err: string?)?): uv.uv_shutdown_t?, string?, uv.error_name?`)
                                See |uv_stream_t:shutdown()|.
      • {try_write}             (`fun(self: uv.uv_stream_t, data: uv.buffer): integer?, string?, uv.error_name?`)
                                See |uv_stream_t:try_write()|.
      • {try_write2}            (`fun(self: uv.uv_stream_t, data: uv.buffer, send_handle: uv.uv_stream_t): integer?, string?, uv.error_name?`)
                                See |uv_stream_t:try_write2()|.
      • {write}                 (`fun(self: uv.uv_stream_t, data: uv.buffer, callback: fun(err: string?)?): uv.uv_write_t?, string?, uv.error_name?`)
                                See |uv_stream_t:write()|.
      • {write2}                (`fun(self: uv.uv_stream_t, data: uv.buffer, send_handle: uv.uv_stream_t, callback: fun(err: string?)?): uv.uv_write_t?, string?, uv.error_name?`)
                                See |uv_stream_t:write2()|.


uv.accept({stream}, {client_stream})                             *uv.accept()*
    This call is used in conjunction with `uv.listen()` to accept incoming
    connections. Call this function after receiving a callback to accept the
    connection.

    When the connection callback is called it is guaranteed that this function
    will complete successfully the first time. If you attempt to use it more
    than once, it may fail. It is suggested to only call this function once
    per connection call. Example >lua
        server:listen(128, function (err)
          local client = uv.new_tcp()
          server:accept(client)
        end)
<

    Parameters: ~
      • {stream}         (`uv.uv_stream_t`)
      • {client_stream}  (`uv.uv_stream_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.is_readable({stream})                                    *uv.is_readable()*
    Returns `true` if the stream is readable, `false` otherwise.

    Parameters: ~
      • {stream}  (`uv.uv_stream_t`)

    Return: ~
        (`boolean`)

uv.is_writable({stream})                                    *uv.is_writable()*
    Returns `true` if the stream is writable, `false` otherwise.

    Parameters: ~
      • {stream}  (`uv.uv_stream_t`)

    Return: ~
        (`boolean`)

uv.listen({stream}, {backlog}, {callback})                       *uv.listen()*
    Start listening for incoming connections. `backlog` indicates the number
    of connections the kernel might queue, same as `listen(2)`. When a new
    incoming connection is received the callback is called.

    Parameters: ~
      • {stream}    (`uv.uv_stream_t`)
      • {backlog}   (`integer`)
      • {callback}  (`fun(err: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.read_start({stream}, {callback})                          *uv.read_start()*
    Read data from an incoming stream. The callback will be made several times
    until there is no more data to read or `uv.read_stop()` is called. When
    we've reached EOF, `data` will be `nil`. Example >lua
        stream:read_start(function (err, chunk)
          if err then
            -- handle read error
          elseif chunk then
            -- handle data
          else
            -- handle disconnect
          end
        end)
<

    Parameters: ~
      • {stream}    (`uv.uv_stream_t`)
      • {callback}  (`fun(err: string?, data: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.read_stop({stream})                                        *uv.read_stop()*
    Stop reading data from the stream. The read callback will no longer be
    called.

    This function is idempotent and may be safely called on a stopped stream.

    Parameters: ~
      • {stream}  (`uv.uv_stream_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.shutdown({stream}, {callback})                              *uv.shutdown()*
    Shutdown the outgoing (write) side of a duplex stream. It waits for
    pending write requests to complete. The callback is called after shutdown
    is complete.

    Parameters: ~
      • {stream}    (`uv.uv_stream_t`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_shutdown_t?`) shutdown
        (`string?`) err
        (`uv.error_name?`) err_name

uv.stream_get_write_queue_size({stream})    *uv.stream_get_write_queue_size()*
    Returns the stream's write queue size.

    Parameters: ~
      • {stream}  (`uv.uv_stream_t`)

    Return: ~
        (`integer`)

uv.stream_set_blocking({stream}, {blocking})        *uv.stream_set_blocking()*
    Enable or disable blocking mode for a stream.

    When blocking mode is enabled all writes complete synchronously. The
    interface remains unchanged otherwise, e.g. completion or failure of the
    operation will still be reported through a callback which is made
    asynchronously. Warning: Relying too much on this API is not recommended.
    It is likely to change significantly in the future. Currently this only
    works on Windows and only for `uv_pipe_t` handles. Also libuv currently
    makes no ordering guarantee when the blocking mode is changed after write
    requests have already been submitted. Therefore it is recommended to set
    the blocking mode immediately after opening or creating the stream.

    Parameters: ~
      • {stream}    (`uv.uv_stream_t`)
      • {blocking}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.try_write({stream}, {data})                                *uv.try_write()*
    Same as `uv.write()`, but won't queue a write request if it can't be
    completed immediately.

    Will return number of bytes written (can be less than the supplied buffer
    size).

    Parameters: ~
      • {stream}  (`uv.uv_stream_t`)
      • {data}    (`uv.buffer`)

    Return (multiple): ~
        (`integer?`) bytes_written
        (`string?`) err
        (`uv.error_name?`) err_name

uv.try_write2({stream}, {data}, {send_handle})               *uv.try_write2()*
    Like `uv.write2()`, but with the properties of `uv.try_write()`. Not
    supported on Windows, where it returns `UV_EAGAIN`.

    Will return number of bytes written (can be less than the supplied buffer
    size).

    Parameters: ~
      • {stream}       (`uv.uv_stream_t`)
      • {data}         (`uv.buffer`)
      • {send_handle}  (`uv.uv_stream_t`)

    Return (multiple): ~
        (`integer?`) bytes_written
        (`string?`) err
        (`uv.error_name?`) err_name

uv.write({stream}, {data}, {callback})                            *uv.write()*
    Write data to stream.

    `data` can either be a Lua string or a table of strings. If a table is
    passed in, the C backend will use writev to send all strings in a single
    system call.

    The optional `callback` is for knowing when the write is complete.

    Parameters: ~
      • {stream}    (`uv.uv_stream_t`)
      • {data}      (`uv.buffer`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_write_t?`) write
        (`string?`) err
        (`uv.error_name?`) err_name

uv.write2({stream}, {data}, {send_handle}, {callback})           *uv.write2()*
    Extended write function for sending handles over a pipe. The pipe must be
    initialized with `ipc` option `true`. Note: `send_handle` must be a TCP
    socket or pipe, which is a server or a connection (listening or connected
    state). Bound sockets or pipes will be assumed to be servers.

    Parameters: ~
      • {stream}       (`uv.uv_stream_t`)
      • {data}         (`uv.buffer`)
      • {send_handle}  (`uv.uv_stream_t`)
      • {callback}     (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_write_t?`) write
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:accept({client_stream})                     *uv_stream_t:accept()*
    This call is used in conjunction with `uv.listen()` to accept incoming
    connections. Call this function after receiving a callback to accept the
    connection.

    When the connection callback is called it is guaranteed that this function
    will complete successfully the first time. If you attempt to use it more
    than once, it may fail. It is suggested to only call this function once
    per connection call. Example >lua
        server:listen(128, function (err)
          local client = uv.new_tcp()
          server:accept(client)
        end)
<

    Parameters: ~
      • {client_stream}  (`uv.uv_stream_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:get_write_queue_size()        *uv_stream_t:get_write_queue_size()*
    Returns the stream's write queue size.

    Return: ~
        (`integer`)

uv_stream_t:is_readable()                          *uv_stream_t:is_readable()*
    Returns `true` if the stream is readable, `false` otherwise.

    Return: ~
        (`boolean`)

uv_stream_t:is_writable()                          *uv_stream_t:is_writable()*
    Returns `true` if the stream is writable, `false` otherwise.

    Return: ~
        (`boolean`)

uv_stream_t:listen({backlog}, {callback})               *uv_stream_t:listen()*
    Start listening for incoming connections. `backlog` indicates the number
    of connections the kernel might queue, same as `listen(2)`. When a new
    incoming connection is received the callback is called.

    Parameters: ~
      • {backlog}   (`integer`)
      • {callback}  (`fun(err: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:read_start({callback})                  *uv_stream_t:read_start()*
    Read data from an incoming stream. The callback will be made several times
    until there is no more data to read or `uv.read_stop()` is called. When
    we've reached EOF, `data` will be `nil`. Example >lua
        stream:read_start(function (err, chunk)
          if err then
            -- handle read error
          elseif chunk then
            -- handle data
          else
            -- handle disconnect
          end
        end)
<

    Parameters: ~
      • {callback}  (`fun(err: string?, data: string?)`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:read_stop()                              *uv_stream_t:read_stop()*
    Stop reading data from the stream. The read callback will no longer be
    called.

    This function is idempotent and may be safely called on a stopped stream.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:set_blocking({blocking})              *uv_stream_t:set_blocking()*
    Enable or disable blocking mode for a stream.

    When blocking mode is enabled all writes complete synchronously. The
    interface remains unchanged otherwise, e.g. completion or failure of the
    operation will still be reported through a callback which is made
    asynchronously. Warning: Relying too much on this API is not recommended.
    It is likely to change significantly in the future. Currently this only
    works on Windows and only for `uv_pipe_t` handles. Also libuv currently
    makes no ordering guarantee when the blocking mode is changed after write
    requests have already been submitted. Therefore it is recommended to set
    the blocking mode immediately after opening or creating the stream.

    Parameters: ~
      • {blocking}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:shutdown({callback})                      *uv_stream_t:shutdown()*
    Shutdown the outgoing (write) side of a duplex stream. It waits for
    pending write requests to complete. The callback is called after shutdown
    is complete.

    Parameters: ~
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_shutdown_t?`) shutdown
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:try_write({data})                        *uv_stream_t:try_write()*
    Same as `uv.write()`, but won't queue a write request if it can't be
    completed immediately.

    Will return number of bytes written (can be less than the supplied buffer
    size).

    Parameters: ~
      • {data}  (`uv.buffer`)

    Return (multiple): ~
        (`integer?`) bytes_written
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:try_write2({data}, {send_handle})       *uv_stream_t:try_write2()*
    Like `uv.write2()`, but with the properties of `uv.try_write()`. Not
    supported on Windows, where it returns `UV_EAGAIN`.

    Will return number of bytes written (can be less than the supplied buffer
    size).

    Parameters: ~
      • {data}         (`uv.buffer`)
      • {send_handle}  (`uv.uv_stream_t`)

    Return (multiple): ~
        (`integer?`) bytes_written
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:write({data}, {callback})                    *uv_stream_t:write()*
    Write data to stream.

    `data` can either be a Lua string or a table of strings. If a table is
    passed in, the C backend will use writev to send all strings in a single
    system call.

    The optional `callback` is for knowing when the write is complete.

    Parameters: ~
      • {data}      (`uv.buffer`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_write_t?`) write
        (`string?`) err
        (`uv.error_name?`) err_name

uv_stream_t:write2({data}, {send_handle}, {callback})   *uv_stream_t:write2()*
    Extended write function for sending handles over a pipe. The pipe must be
    initialized with `ipc` option `true`. Note: `send_handle` must be a TCP
    socket or pipe, which is a server or a connection (listening or connected
    state). Bound sockets or pipes will be assumed to be servers.

    Parameters: ~
      • {data}         (`uv.buffer`)
      • {send_handle}  (`uv.uv_stream_t`)
      • {callback}     (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_write_t?`) write
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_tcp_t` - TCP handle                                       *luv-tcp-handle*

uv.uv_tcp_t                                           *uv.uv_tcp_t* *uv_tcp_t*
    Extends: |uv.uv_stream_t|

    |uv_handle_t| and |uv_stream_t| functions also apply.

    TCP handles are used to represent both TCP streams and servers.

    Fields: ~
      • {bind}                  (`fun(self: uv.uv_tcp_t, host: string, port: integer, flags: { ipv6only: boolean? }?): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:bind()|.
      • {close_reset}           (`fun(self: uv.uv_tcp_t, callback: fun()?): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:close_reset()|.
      • {connect}               (`fun(self: uv.uv_tcp_t, host: string, port: integer, callback: fun(err: string?)?): uv.uv_connect_t?, string?, uv.error_name?`)
                                See |uv_tcp_t:connect()|.
      • {getpeername}           (`fun(self: uv.uv_tcp_t): uv.socketinfo?, string?, uv.error_name?`)
                                See |uv_tcp_t:getpeername()|.
      • {getsockname}           (`fun(self: uv.uv_tcp_t): uv.socketinfo?, string?, uv.error_name?`)
                                See |uv_tcp_t:getsockname()|.
      • {keepalive}             (`fun(self: uv.uv_tcp_t, enable: boolean, delay: integer?, intvl: integer?, cnt: integer?): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:keepalive()|.
      • {nodelay}               (`fun(self: uv.uv_tcp_t, enable: boolean): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:nodelay()|.
      • {open}                  (`fun(self: uv.uv_tcp_t, sock: integer): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:open()|.
      • {simultaneous_accepts}  (`fun(self: uv.uv_tcp_t, enable: boolean): 0?, string?, uv.error_name?`)
                                See |uv_tcp_t:simultaneous_accepts()|.


uv.new_tcp({flags})                                             *uv.new_tcp()*
    Creates and initializes a new `uv_tcp_t`. Returns the Lua userdata
    wrapping it.

    If set, `flags` must be a valid address family. See |luv-constants| for
    supported address family input values.

    Parameters: ~
      • {flags}  (`string|integer?`)

    Return (multiple): ~
        (`uv.uv_tcp_t?`) tcp
        (`string?`) err
        (`uv.error_name?`) err_name

uv.socketpair({socktype}, {protocol}, {flags1}, {flags2})    *uv.socketpair()*
    Create a pair of connected sockets with the specified properties. The
    resulting handles can be passed to `uv.tcp_open`, used with `uv.spawn`, or
    for any other purpose.

    See |luv-constants| for supported `socktype` input values.

    When `protocol` is set to 0 or nil, it will be automatically chosen based
    on the socket's domain and type. When `protocol` is specified as a string,
    it will be looked up using the `getprotobyname(3)` function (examples:
    `"ip"`, `"icmp"`, `"tcp"`, `"udp"`, etc).

    Flags:
    • `nonblock`: Opens the specified socket handle for `OVERLAPPED` or
      `FIONBIO`/`O_NONBLOCK` I/O usage. This is recommended for handles that
      will be used by libuv, and not usually recommended otherwise.

    Equivalent to `socketpair(2)` with a domain of `AF_UNIX`. Example >lua
        -- Simple read/write with tcp
        local fds = uv.socketpair(nil, nil, {nonblock=true}, {nonblock=true})

        local sock1 = uv.new_tcp()
        sock1:open(fds[1])

        local sock2 = uv.new_tcp()
        sock2:open(fds[2])

        sock1:write("hello")
        sock2:read_start(function(err, chunk)
          assert(not err, err)
          print(chunk)
        end)
<

    Parameters: ~
      • {socktype}  (`string|integer?`)
      • {protocol}  (`string|integer?`)
      • {flags1}    (`{ nonblock: boolean? }?`)
      • {flags2}    (`{ nonblock: boolean? }?`)

    Return (multiple): ~
        (`[integer, integer]?`) fds
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_bind({tcp}, {host}, {port}, {flags})                    *uv.tcp_bind()*
    Bind the handle to an host and port. `host` should be an IP address and
    not a domain name. Any `flags` are set with a table with field `ipv6only`
    equal to `true` or `false`.

    When the port is already taken, you can expect to see an `EADDRINUSE`
    error from either `uv.tcp_bind()`, `uv.listen()` or `uv.tcp_connect()`.
    That is, a successful call to this function does not guarantee that the
    call to `uv.listen()` or `uv.tcp_connect()` will succeed as well.

    Use a port of `0` to let the OS assign an ephemeral port. You can look it
    up later using `uv.tcp_getsockname()`.

    Parameters: ~
      • {tcp}    (`uv.uv_tcp_t`)
      • {host}   (`string`)
      • {port}   (`integer`)
      • {flags}  (`{ ipv6only: boolean? }?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_close_reset({tcp}, {callback})                   *uv.tcp_close_reset()*
    Resets a TCP connection by sending a RST packet. This is accomplished by
    setting the SO_LINGER socket option with a linger interval of zero and
    then calling `uv.close()`. Due to some platform inconsistencies, mixing of
    `uv.shutdown()` and `uv.tcp_close_reset()` calls is not allowed.

    Parameters: ~
      • {tcp}       (`uv.uv_tcp_t`)
      • {callback}  (`fun()?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_connect({tcp}, {host}, {port}, {callback})           *uv.tcp_connect()*
    Establish an IPv4 or IPv6 TCP connection. Example >lua
        local client = uv.new_tcp()
        client:connect("127.0.0.1", 8080, function (err)
          -- check error and carry on.
        end)
<

    Parameters: ~
      • {tcp}       (`uv.uv_tcp_t`)
      • {host}      (`string`)
      • {port}      (`integer`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_getpeername({tcp})                               *uv.tcp_getpeername()*
    Get the address of the peer connected to the handle.

    See |luv-constants| for supported address `family` output values.

    Parameters: ~
      • {tcp}  (`uv.uv_tcp_t`)

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_getsockname({tcp})                               *uv.tcp_getsockname()*
    Get the current address to which the handle is bound.

    See |luv-constants| for supported address `family` output values.

    Parameters: ~
      • {tcp}  (`uv.uv_tcp_t`)

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_keepalive({tcp}, {enable}, {delay}, {intvl}, {cnt})  *uv.tcp_keepalive()*
    Enable / disable TCP keep-alive. `delay` is the initial delay in seconds,
    `intvl` is the time in seconds between individual keep-alive probes, and
    `cnt` is the number of probes to send before assuming the connection is
    dead. ignored when enable is `false`. Note: `intvl` and `cnt` are only
    supported with Libuv >= 1.52.0.

    Parameters: ~
      • {tcp}     (`uv.uv_tcp_t`)
      • {enable}  (`boolean`)
      • {delay}   (`integer?`)
      • {intvl}   (`integer?`)
      • {cnt}     (`integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_nodelay({tcp}, {enable})                             *uv.tcp_nodelay()*
    Enable / disable Nagle's algorithm.

    Parameters: ~
      • {tcp}     (`uv.uv_tcp_t`)
      • {enable}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_open({tcp}, {sock})                                     *uv.tcp_open()*
    Open an existing file descriptor or SOCKET as a TCP handle. Note: The
    passed file descriptor or SOCKET is not checked for its type, but it's
    required that it represents a valid stream socket.

    Parameters: ~
      • {tcp}   (`uv.uv_tcp_t`)
      • {sock}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tcp_simultaneous_accepts({tcp}, {enable})   *uv.tcp_simultaneous_accepts()*
    Enable / disable simultaneous asynchronous accept requests that are queued
    by the operating system when listening for new TCP connections.

    This setting is used to tune a TCP server for the desired performance.
    Having simultaneous accepts can significantly improve the rate of
    accepting connections (which is why it is enabled by default) but may lead
    to uneven load distribution in multi-process setups.

    Parameters: ~
      • {tcp}     (`uv.uv_tcp_t`)
      • {enable}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:bind({host}, {port}, {flags})                       *uv_tcp_t:bind()*
    Bind the handle to an host and port. `host` should be an IP address and
    not a domain name. Any `flags` are set with a table with field `ipv6only`
    equal to `true` or `false`.

    When the port is already taken, you can expect to see an `EADDRINUSE`
    error from either `uv.tcp_bind()`, `uv.listen()` or `uv.tcp_connect()`.
    That is, a successful call to this function does not guarantee that the
    call to `uv.listen()` or `uv.tcp_connect()` will succeed as well.

    Use a port of `0` to let the OS assign an ephemeral port. You can look it
    up later using `uv.tcp_getsockname()`.

    Parameters: ~
      • {host}   (`string`)
      • {port}   (`integer`)
      • {flags}  (`{ ipv6only: boolean? }?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:close_reset({callback})                      *uv_tcp_t:close_reset()*
    Resets a TCP connection by sending a RST packet. This is accomplished by
    setting the SO_LINGER socket option with a linger interval of zero and
    then calling `uv.close()`. Due to some platform inconsistencies, mixing of
    `uv.shutdown()` and `uv.tcp_close_reset()` calls is not allowed.

    Parameters: ~
      • {callback}  (`fun()?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:connect({host}, {port}, {callback})              *uv_tcp_t:connect()*
    Establish an IPv4 or IPv6 TCP connection. Example >lua
        local client = uv.new_tcp()
        client:connect("127.0.0.1", 8080, function (err)
          -- check error and carry on.
        end)
<

    Parameters: ~
      • {host}      (`string`)
      • {port}      (`integer`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:getpeername()                                *uv_tcp_t:getpeername()*
    Get the address of the peer connected to the handle.

    See |luv-constants| for supported address `family` output values.

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:getsockname()                                *uv_tcp_t:getsockname()*
    Get the current address to which the handle is bound.

    See |luv-constants| for supported address `family` output values.

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:keepalive({enable}, {delay}, {intvl}, {cnt})   *uv_tcp_t:keepalive()*
    Enable / disable TCP keep-alive. `delay` is the initial delay in seconds,
    `intvl` is the time in seconds between individual keep-alive probes, and
    `cnt` is the number of probes to send before assuming the connection is
    dead. ignored when enable is `false`. Note: `intvl` and `cnt` are only
    supported with Libuv >= 1.52.0.

    Parameters: ~
      • {enable}  (`boolean`)
      • {delay}   (`integer?`)
      • {intvl}   (`integer?`)
      • {cnt}     (`integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:nodelay({enable})                                *uv_tcp_t:nodelay()*
    Enable / disable Nagle's algorithm.

    Parameters: ~
      • {enable}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:open({sock})                                        *uv_tcp_t:open()*
    Open an existing file descriptor or SOCKET as a TCP handle. Note: The
    passed file descriptor or SOCKET is not checked for its type, but it's
    required that it represents a valid stream socket.

    Parameters: ~
      • {sock}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_tcp_t:simultaneous_accepts({enable})      *uv_tcp_t:simultaneous_accepts()*
    Enable / disable simultaneous asynchronous accept requests that are queued
    by the operating system when listening for new TCP connections.

    This setting is used to tune a TCP server for the desired performance.
    Having simultaneous accepts can significantly improve the rate of
    accepting connections (which is why it is enabled by default) but may lead
    to uneven load distribution in multi-process setups.

    Parameters: ~
      • {enable}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_pipe_t` - Pipe handle                                    *luv-pipe-handle*

uv.pipe.fds                                                      *uv.pipe.fds*

    Fields: ~
      • {read}   (`integer`) (file descriptor)
      • {write}  (`integer`) (file descriptor)

uv.uv_pipe_t                                        *uv.uv_pipe_t* *uv_pipe_t*
    Extends: |uv.uv_stream_t|

    |uv_handle_t| and |uv_stream_t| functions also apply.

    Pipe handles provide an abstraction over local domain sockets on Unix and
    named pipes on Windows. >lua
        local pipe = uv.new_pipe(false)

        pipe:bind('/tmp/sock.test')

        pipe:listen(128, function()
          local client = uv.new_pipe(false)
          pipe:accept(client)
          client:write("hello!\n")
          client:close()
        end)
<

    Fields: ~
      • {bind}               (`fun(self: uv.uv_pipe_t, name: string): 0?, string?, uv.error_name?`)
                             See |uv_pipe_t:bind()|.
      • {bind2}              (`fun(self: uv.uv_pipe_t, name: string, flags: integer|table?): 0?, string?, uv.error_name?`)
                             See |uv_pipe_t:bind2()|.
      • {chmod}              (`fun(self: uv.uv_pipe_t, flags: string): 0?, string?, uv.error_name?`)
                             See |uv_pipe_t:chmod()|.
      • {connect}            (`fun(self: uv.uv_pipe_t, name: string, callback: fun(err: string?)?): uv.uv_connect_t?, string?, uv.error_name?`)
                             See |uv_pipe_t:connect()|.
      • {connect2}           (`fun(self: uv.uv_pipe_t, name: string, flags: integer|table?, callback: fun(err: string?)?): uv.uv_connect_t?, string?, uv.error_name?`)
                             See |uv_pipe_t:connect2()|.
      • {getpeername}        (`fun(self: uv.uv_pipe_t): string?, string?, uv.error_name?`)
                             See |uv_pipe_t:getpeername()|.
      • {getsockname}        (`fun(self: uv.uv_pipe_t): string?, string?, uv.error_name?`)
                             See |uv_pipe_t:getsockname()|.
      • {open}               (`fun(self: uv.uv_pipe_t, fd: integer): 0?, string?, uv.error_name?`)
                             See |uv_pipe_t:open()|.
      • {pending_count}      (`fun(self: uv.uv_pipe_t): integer`) See
                             |uv_pipe_t:pending_count()|.
      • {pending_instances}  (`fun(self: uv.uv_pipe_t, count: integer)`) See
                             |uv_pipe_t:pending_instances()|.
      • {pending_type}       (`fun(self: uv.uv_pipe_t): string`) See
                             |uv_pipe_t:pending_type()|.


uv.new_pipe({ipc})                                             *uv.new_pipe()*
    Creates and initializes a new `uv_pipe_t`. Returns the Lua userdata
    wrapping it. The `ipc` argument is a boolean to indicate if this pipe will
    be used for handle passing between processes.

    Parameters: ~
      • {ipc}  (`boolean?`)

    Return (multiple): ~
        (`uv.uv_pipe_t?`) pipe
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe({read_flags}, {write_flags})                               *uv.pipe()*
    Create a pair of connected pipe handles. Data may be written to the
    `write` fd and read from the `read` fd. The resulting handles can be
    passed to `pipe_open`, used with `spawn`, or for any other purpose.

    Flags:
    • `nonblock`: Opens the specified socket handle for `OVERLAPPED` or
      `FIONBIO`/`O_NONBLOCK` I/O usage. This is recommended for handles that
      will be used by libuv, and not usually recommended otherwise.

    Equivalent to `pipe(2)` with the `O_CLOEXEC` flag set. Example >lua
        -- Simple read/write with pipe_open
        local fds = uv.pipe({nonblock=true}, {nonblock=true})

        local read_pipe = uv.new_pipe()
        read_pipe:open(fds.read)

        local write_pipe = uv.new_pipe()
        write_pipe:open(fds.write)

        write_pipe:write("hello")
        read_pipe:read_start(function(err, chunk)
          assert(not err, err)
          print(chunk)
        end)
<

    Parameters: ~
      • {read_flags}   (`{ nonblock: boolean? }?`)
      • {write_flags}  (`{ nonblock: boolean? }?`)

    Return (multiple): ~
        (`uv.pipe.fds?`) fds
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_bind({pipe}, {name})                                  *uv.pipe_bind()*
    Bind the pipe to a file path (Unix) or a name (Windows). Note: Paths on
    Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, typically
    between 92 and 108 bytes.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)
      • {name}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_bind2({pipe}, {name}, {flags})                       *uv.pipe_bind2()*
    Bind the pipe to a file path (Unix) or a name (Windows).

    `Flags`:
    • If `type(flags)` is `number`, it must be `0` or
      `uv.constants.PIPE_NO_TRUNCATE`.
    • If `type(flags)` is `table`, it must be `{}` or
      `{ no_truncate = true|false }`.
    • If `type(flags)` is `nil`, it use default value `0`.
    • Returns `EINVAL` for unsupported flags without performing the bind
      operation.

    Supports Linux abstract namespace sockets. namelen must include the
    leading '\0' byte but not the trailing nul byte. Note:
    1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
       typically between 92 and 108 bytes.
    2. New in version 1.46.0.

    Parameters: ~
      • {pipe}   (`uv.uv_pipe_t`)
      • {name}   (`string`)
      • {flags}  (`integer|table?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_chmod({pipe}, {flags})                               *uv.pipe_chmod()*
    Alters pipe permissions, allowing it to be accessed from processes run by
    different users. Makes the pipe writable or readable by all users. `flags`
    are: `"r"`, `"w"`, `"rw"`, or `"wr"` where `r` is `READABLE` and `w` is
    `WRITABLE`. This function is blocking.

    Parameters: ~
      • {pipe}   (`uv.uv_pipe_t`)
      • {flags}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_connect({pipe}, {name}, {callback})                *uv.pipe_connect()*
    Connect to the Unix domain socket or the named pipe. Note: Paths on Unix
    get truncated to sizeof(sockaddr_un.sun_path) bytes, typically between 92
    and 108 bytes.

    Parameters: ~
      • {pipe}      (`uv.uv_pipe_t`)
      • {name}      (`string`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_connect2({pipe}, {name}, {flags}, {callback})     *uv.pipe_connect2()*
    Connect to the Unix domain socket or the named pipe.

    `Flags`:
    • If `type(flags)` is `number`, it must be `0` or
      `uv.constants.PIPE_NO_TRUNCATE`.
    • If `type(flags)` is `table`, it must be `{}` or
      `{ no_truncate = true|false }`.
    • If `type(flags)` is `nil`, it use default value `0`.
    • Returns `EINVAL` for unsupported flags without performing the bind
      operation.

    Supports Linux abstract namespace sockets. namelen must include the
    leading nul byte but not the trailing nul byte. Note:
    1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
       typically between 92 and 108 bytes.
    2. New in version 1.46.0.

    Parameters: ~
      • {pipe}      (`uv.uv_pipe_t`)
      • {name}      (`string`)
      • {flags}     (`integer|table?`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_getpeername({pipe})                            *uv.pipe_getpeername()*
    Get the name of the Unix domain socket or the named pipe to which the
    handle is connected.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_getsockname({pipe})                            *uv.pipe_getsockname()*
    Get the name of the Unix domain socket or the named pipe.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_open({pipe}, {fd})                                    *uv.pipe_open()*
    Open an existing file descriptor or |uv_handle_t| as a pipe. Note: The
    file descriptor is set to non-blocking mode.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)
      • {fd}    (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.pipe_pending_count({pipe})                        *uv.pipe_pending_count()*
    Returns the pending pipe count for the named pipe.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)

    Return: ~
        (`integer`)

uv.pipe_pending_instances({pipe}, {count})       *uv.pipe_pending_instances()*
    Set the number of pending pipe instance handles when the pipe server is
    waiting for connections. Note: This setting applies to Windows only.

    Parameters: ~
      • {pipe}   (`uv.uv_pipe_t`)
      • {count}  (`integer`)

uv.pipe_pending_type({pipe})                          *uv.pipe_pending_type()*
    Used to receive handles over IPC pipes.

    First - call `uv.pipe_pending_count()`, if it's > 0 then initialize a
    handle of the given type, returned by `uv.pipe_pending_type()` and call
    `uv.accept(pipe, handle)`.

    Parameters: ~
      • {pipe}  (`uv.uv_pipe_t`)

    Return: ~
        (`string`)

uv_pipe_t:bind({name})                                      *uv_pipe_t:bind()*
    Bind the pipe to a file path (Unix) or a name (Windows). Note: Paths on
    Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, typically
    between 92 and 108 bytes.

    Parameters: ~
      • {name}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:bind2({name}, {flags})                           *uv_pipe_t:bind2()*
    Bind the pipe to a file path (Unix) or a name (Windows).

    `Flags`:
    • If `type(flags)` is `number`, it must be `0` or
      `uv.constants.PIPE_NO_TRUNCATE`.
    • If `type(flags)` is `table`, it must be `{}` or
      `{ no_truncate = true|false }`.
    • If `type(flags)` is `nil`, it use default value `0`.
    • Returns `EINVAL` for unsupported flags without performing the bind
      operation.

    Supports Linux abstract namespace sockets. namelen must include the
    leading '\0' byte but not the trailing nul byte. Note:
    1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
       typically between 92 and 108 bytes.
    2. New in version 1.46.0.

    Parameters: ~
      • {name}   (`string`)
      • {flags}  (`integer|table?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:chmod({flags})                                   *uv_pipe_t:chmod()*
    Alters pipe permissions, allowing it to be accessed from processes run by
    different users. Makes the pipe writable or readable by all users. `flags`
    are: `"r"`, `"w"`, `"rw"`, or `"wr"` where `r` is `READABLE` and `w` is
    `WRITABLE`. This function is blocking.

    Parameters: ~
      • {flags}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:connect({name}, {callback})                    *uv_pipe_t:connect()*
    Connect to the Unix domain socket or the named pipe. Note: Paths on Unix
    get truncated to sizeof(sockaddr_un.sun_path) bytes, typically between 92
    and 108 bytes.

    Parameters: ~
      • {name}      (`string`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:connect2({name}, {flags}, {callback})         *uv_pipe_t:connect2()*
    Connect to the Unix domain socket or the named pipe.

    `Flags`:
    • If `type(flags)` is `number`, it must be `0` or
      `uv.constants.PIPE_NO_TRUNCATE`.
    • If `type(flags)` is `table`, it must be `{}` or
      `{ no_truncate = true|false }`.
    • If `type(flags)` is `nil`, it use default value `0`.
    • Returns `EINVAL` for unsupported flags without performing the bind
      operation.

    Supports Linux abstract namespace sockets. namelen must include the
    leading nul byte but not the trailing nul byte. Note:
    1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
       typically between 92 and 108 bytes.
    2. New in version 1.46.0.

    Parameters: ~
      • {name}      (`string`)
      • {flags}     (`integer|table?`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`uv.uv_connect_t?`) connect
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:getpeername()                              *uv_pipe_t:getpeername()*
    Get the name of the Unix domain socket or the named pipe to which the
    handle is connected.

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:getsockname()                              *uv_pipe_t:getsockname()*
    Get the name of the Unix domain socket or the named pipe.

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:open({fd})                                        *uv_pipe_t:open()*
    Open an existing file descriptor or |uv_handle_t| as a pipe. Note: The
    file descriptor is set to non-blocking mode.

    Parameters: ~
      • {fd}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_pipe_t:pending_count()                          *uv_pipe_t:pending_count()*
    Returns the pending pipe count for the named pipe.

    Return: ~
        (`integer`)

uv_pipe_t:pending_instances({count})           *uv_pipe_t:pending_instances()*
    Set the number of pending pipe instance handles when the pipe server is
    waiting for connections. Note: This setting applies to Windows only.

    Parameters: ~
      • {count}  (`integer`)

uv_pipe_t:pending_type()                            *uv_pipe_t:pending_type()*
    Used to receive handles over IPC pipes.

    First - call `uv.pipe_pending_count()`, if it's > 0 then initialize a
    handle of the given type, returned by `uv.pipe_pending_type()` and call
    `uv.accept(pipe, handle)`.

    Return: ~
        (`string`)


==============================================================================
`uv_tty_t` - TTY handle                                       *luv-tty-handle*

uv.uv_tty_t                                           *uv.uv_tty_t* *uv_tty_t*
    Extends: |uv.uv_stream_t|

    |uv_handle_t| and |uv_stream_t| functions also apply.

    TTY handles represent a stream for the console. >lua
        -- Simple echo program
        local stdin = uv.new_tty(0, true)
        local stdout = uv.new_tty(1, false)

        stdin:read_start(function (err, data)
          assert(not err, err)
          if data then
            stdout:write(data)
          else
            stdin:close()
            stdout:close()
          end
        end)
<

    Fields: ~
      • {get_winsize}  (`fun(self: uv.uv_tty_t): integer?, integer|string, uv.error_name?`)
                       See |uv_tty_t:get_winsize()|.
      • {set_mode}     (`fun(self: uv.uv_tty_t, mode: string|integer): 0?, string?, uv.error_name?`)
                       See |uv_tty_t:set_mode()|.


uv.new_tty({fd}, {readable})                                    *uv.new_tty()*
    Initialize a new TTY stream with the given file descriptor. Usually the
    file descriptor will be:
    • 0 - stdin
    • 1 - stdout
    • 2 - stderr

    On Unix this function will determine the path of the fd of the terminal
    using ttyname_r(3), open it, and use it if the passed file descriptor
    refers to a TTY. This lets libuv put the tty in non-blocking mode without
    affecting other processes that share the tty.

    This function is not thread safe on systems that don’t support ioctl
    TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and Solaris. Note: If
    reopening the TTY fails, libuv falls back to blocking writes.

    Parameters: ~
      • {fd}        (`integer`)
      • {readable}  (`boolean`)

    Return (multiple): ~
        (`uv.uv_tty_t?`) tty
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tty_get_vterm_state()                            *uv.tty_get_vterm_state()*
    Get the current state of whether console virtual terminal sequences are
    handled by libuv or the console. The return value is `"supported"` or
    `"unsupported"`.

    This function is not implemented on Unix, where it returns `ENOTSUP`.

    Return (multiple): ~
        (`string?`) state
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tty_get_winsize({tty})                               *uv.tty_get_winsize()*
    Gets the current Window width and height.

    Parameters: ~
      • {tty}  (`uv.uv_tty_t`)

    Return (multiple): ~
        (`integer?`) width
        (`integer|string`) height_or_err
        (`uv.error_name?`) err_name

uv.tty_reset_mode()                                      *uv.tty_reset_mode()*
    To be called when the program exits. Resets TTY settings to default values
    for the next process to take over.

    This function is async signal-safe on Unix platforms but can fail with
    error code `EBUSY` if you call it when execution is inside
    `uv.tty_set_mode()`.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tty_set_mode({tty}, {mode})                             *uv.tty_set_mode()*
    Set the TTY using the specified terminal mode.

    See |luv-constants| for supported TTY mode input values.

    Parameters: ~
      • {tty}   (`uv.uv_tty_t`)
      • {mode}  (`string|integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.tty_set_vterm_state({state})                     *uv.tty_set_vterm_state()*
    Controls whether console virtual terminal sequences are processed by libuv
    or console. Useful in particular for enabling ConEmu support of ANSI X3.64
    and Xterm 256 colors. Otherwise Windows10 consoles are usually detected
    automatically. State should be one of: `"supported"` or `"unsupported"`.

    This function is only meaningful on Windows systems. On Unix it is
    silently ignored.

    Parameters: ~
      • {state}  (`string`)

uv_tty_t:get_winsize()                                *uv_tty_t:get_winsize()*
    Gets the current Window width and height.

    Return (multiple): ~
        (`integer?`) width
        (`integer|string`) height_or_err
        (`uv.error_name?`) err_name

uv_tty_t:set_mode({mode})                                *uv_tty_t:set_mode()*
    Set the TTY using the specified terminal mode.

    See |luv-constants| for supported TTY mode input values.

    Parameters: ~
      • {mode}  (`string|integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_udp_t` - UDP handle                                       *luv-udp-handle*

uv.udp_bind.flags                                          *uv.udp_bind.flags*

    Fields: ~
      • {ipv6only}       (`boolean?`)
      • {linux_recverr}  (`boolean?`)
      • {reuseaddr}      (`boolean?`)
      • {reuseport}      (`boolean?`)

uv.udp_recv_start.callback.addr              *uv.udp_recv_start.callback.addr*

    Fields: ~
      • {family}  (`string`)
      • {ip}      (`string`)
      • {port}    (`integer`)

uv.uv_udp_t                                           *uv.uv_udp_t* *uv_udp_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    UDP handles encapsulate UDP communication for both clients and servers.

    Fields: ~
      • {bind}                     (`fun(self: uv.uv_udp_t, host: string, port: number, flags: uv.udp_bind.flags?): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:bind()|.
      • {connect}                  (`fun(self: uv.uv_udp_t, host: string?, port: integer?): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:connect()|.
      • {get_send_queue_count}     (`fun(self: uv.uv_udp_t): integer`) See
                                   |uv_udp_t:get_send_queue_count()|.
      • {get_send_queue_size}      (`fun(self: uv.uv_udp_t): integer`) See
                                   |uv_udp_t:get_send_queue_size()|.
      • {getpeername}              (`fun(self: uv.uv_udp_t): uv.socketinfo?, string?, uv.error_name?`)
                                   See |uv_udp_t:getpeername()|.
      • {getsockname}              (`fun(self: uv.uv_udp_t): uv.socketinfo?, string?, uv.error_name?`)
                                   See |uv_udp_t:getsockname()|.
      • {open}                     (`fun(self: uv.uv_udp_t, fd: integer, flags: integer|{ reuseaddr: boolean?, reuseport: boolean? }?): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:open()|.
      • {recv_start}               (`fun(self: uv.uv_udp_t, callback: uv.udp_recv_start.callback): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:recv_start()|.
      • {recv_stop}                (`fun(self: uv.uv_udp_t): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:recv_stop()|.
      • {send}                     (`fun(self: uv.uv_udp_t, data: uv.buffer, host: string?, port: integer?, callback: fun(err: string?)?): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:send()|.
      • {set_broadcast}            (`fun(self: uv.uv_udp_t, on: boolean): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_broadcast()|.
      • {set_membership}           (`fun(self: uv.uv_udp_t, multicast_addr: string, interface_addr: string?, membership: string): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_membership()|.
      • {set_multicast_interface}  (`fun(self: uv.uv_udp_t, interface_addr: string): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_multicast_interface()|.
      • {set_multicast_loop}       (`fun(self: uv.uv_udp_t, on: boolean): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_multicast_loop()|.
      • {set_multicast_ttl}        (`fun(self: uv.uv_udp_t, ttl: integer): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_multicast_ttl()|.
      • {set_source_membership}    (`fun(self: uv.uv_udp_t, multicast_addr: string, interface_addr: string?, source_addr: string, membership: string): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_source_membership()|.
      • {set_ttl}                  (`fun(self: uv.uv_udp_t, ttl: integer): 0?, string?, uv.error_name?`)
                                   See |uv_udp_t:set_ttl()|.
      • {try_send}                 (`fun(self: uv.uv_udp_t, data: uv.buffer, host: string?, port: integer?): integer?, string?, uv.error_name?`)
                                   See |uv_udp_t:try_send()|.
      • {try_send2}                (`fun(self: uv.uv_udp_t, messages: table<integer, { data: uv.buffer, addr: { ip: string, port: integer }? }>, flags: 0): integer?, string?, uv.error_name?`)
                                   See |uv_udp_t:try_send2()|.


uv.new_udp({flags})                                             *uv.new_udp()*
    Creates and initializes a new `uv_udp_t`. Returns the Lua userdata
    wrapping it. The actual socket is created lazily.

    See |luv-constants| for supported address `family` input values.

    When specified, `mmsgs` determines the number of messages able to be
    received at one time via `recvmmsg(2)` (the allocated buffer will be sized
    to be able to fit the specified number of max size dgrams). Only has an
    effect on platforms that support `recvmmsg(2)`.

    Note: For backwards compatibility reasons, `flags` can also be a string or
    integer. When it is a string, it will be treated like the `family` key
    above. When it is an integer, it will be used directly as the `flags`
    parameter when calling `uv_udp_init_ex`.

    Parameters: ~
      • {flags}  (`string|integer|{ family: string|integer?, mmsgs: integer? }?`)

    Return (multiple): ~
        (`uv.uv_udp_t?`) udp
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_bind({udp}, {host}, {port}, {flags})                    *uv.udp_bind()*
    Bind the UDP handle to an IP address and port. Any `flags` are set with a
    table with fields `reuseaddr`, `ipv6only`, `linux_recverr`, `reuseport`
    equal to `true` or `false`.
    • `reuseaddr`: Indicates if SO_REUSEADDR will be set when binding the
      handle. This sets the SO_REUSEPORT socket flag on the BSDs (except for
      DragonFlyBSD), OS X, and other platforms where SO_REUSEPORTs don't have
      the capability of load balancing, as the opposite of what `reuseport`
      would do. On other Unix platforms, it sets the SO_REUSEADDR flag. What
      that means is that multiple threads or processes can bind to the same
      address without error (provided they all set the flag) but only the last
      one to bind will receive any traffic, in effect "stealing" the port from
      the previous listener.
    • `ipv6only`: Disables dual stack mode.
    • `linux_recverr`: Indicates if IP_RECVERR/IPV6_RECVERR will be set when
      binding the handle. This sets IP_RECVERR for IPv4 and IPV6_RECVERR for
      IPv6 UDP sockets on Linux. This stops the Linux kernel from suppressing
      some ICMP error messages and enables full ICMP error reporting for
      faster failover. This flag is no-op on platforms other than Linux.
    • `reuseport`: Indicates if SO_REUSEPORT will be set when binding the
      handle. This sets the SO_REUSEPORT socket option on supported platforms.
      Unlike `reuseaddr`, this flag will make multiple threads or processes
      that are binding to the same address and port "share" the port, which
      means incoming datagrams are distributed across the receiving sockets
      among threads or processes. This flag is available only on Linux 3.9+,
      DragonFlyBSD 3.6+, FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now.
      Note: The flag `linux_recverr` is only supported with Libuv >= 1.42.0.
      The flag `reuseport` is only supported with Libuv >= 1.49.0.

    Parameters: ~
      • {udp}    (`uv.uv_udp_t`)
      • {host}   (`string`)
      • {port}   (`number`)
      • {flags}  (`uv.udp_bind.flags?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_connect({udp}, {host}, {port})                       *uv.udp_connect()*
    Associate the UDP handle to a remote address and port, so every message
    sent by this handle is automatically sent to that destination.

    `host` and `port` must be provided together. Pass explicit `nil` for both
    to disconnect the handle.

    Trying to call `uv.udp_connect()` on an already connected handle will
    result in an `EISCONN` error. Trying to disconnect a handle that is not
    connected will return an `ENOTCONN` error.

    Parameters: ~
      • {udp}   (`uv.uv_udp_t`)
      • {host}  (`string?`)
      • {port}  (`integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_get_send_queue_count({udp})             *uv.udp_get_send_queue_count()*
    Returns the handle's send queue count.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)

    Return: ~
        (`integer`)

uv.udp_get_send_queue_size({udp})               *uv.udp_get_send_queue_size()*
    Returns the handle's send queue size.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)

    Return: ~
        (`integer`)

uv.udp_getpeername({udp})                               *uv.udp_getpeername()*
    Get the remote IP and port of the UDP handle on connected UDP handles.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_getsockname({udp})                               *uv.udp_getsockname()*
    Get the local IP and port of the UDP handle.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_open({udp}, {fd}, {flags})                              *uv.udp_open()*
    Opens an existing file descriptor or Windows SOCKET as a UDP handle.

    Unix only: The only requirement of the sock argument is that it follows
    the datagram contract (works in unconnected mode, supports
    sendmsg()/recvmsg(), etc). In other words, other datagram-type sockets
    like raw sockets or netlink sockets can also be passed to this function.

    The file descriptor is set to non-blocking mode.

    Note: The passed file descriptor or SOCKET is not checked for its type,
    but it's required that it represents a valid datagram socket. Note:
    `flags` is only supported with Libuv >= 1.52.0.

    Parameters: ~
      • {udp}    (`uv.uv_udp_t`)
      • {fd}     (`integer`)
      • {flags}  (`integer|{ reuseaddr: boolean?, reuseport: boolean? }?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_recv_start({udp}, {callback})                     *uv.udp_recv_start()*
    Prepare for receiving data. If the socket has not previously been bound
    with `uv.udp_bind()` it is bound to `0.0.0.0` (the "all interfaces" IPv4
    address) and a random port number.

    See |luv-constants| for supported address `family` output values.

    Parameters: ~
      • {udp}       (`uv.uv_udp_t`)
      • {callback}  (`uv.udp_recv_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_recv_stop({udp})                                   *uv.udp_recv_stop()*
    Stop listening for incoming datagrams.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_send({udp}, {data}, {host}, {port}, {callback})         *uv.udp_send()*
    Send data over the UDP socket. If the socket has not previously been bound
    with `uv.udp_bind()` it will be bound to `0.0.0.0` (the "all interfaces"
    IPv4 address) and a random port number.

    `host` and `port` must be provided together. For a connected socket, pass
    explicit `nil` for both.

    Parameters: ~
      • {udp}       (`uv.uv_udp_t`)
      • {data}      (`uv.buffer`)
      • {host}      (`string?`)
      • {port}      (`integer?`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_broadcast({udp}, {on})                     *uv.udp_set_broadcast()*
    Set broadcast on or off.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)
      • {on}   (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_membership({udp}, {multicast_addr}, {interface_addr}, {membership})  *uv.udp_set_membership()*
    Set membership for a multicast address. `multicast_addr` is multicast
    address to set membership for. `interface_addr` is interface address.
    `membership` can be the string `"leave"` or `"join"`.

    Parameters: ~
      • {udp}             (`uv.uv_udp_t`)
      • {multicast_addr}  (`string`)
      • {interface_addr}  (`string?`)
      • {membership}      (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_multicast_interface({udp}, {interface_addr})  *uv.udp_set_multicast_interface()*
    Set the multicast interface to send or receive data on.

    Parameters: ~
      • {udp}             (`uv.uv_udp_t`)
      • {interface_addr}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_multicast_loop({udp}, {on})           *uv.udp_set_multicast_loop()*
    Set IP multicast loop flag. Makes multicast packets loop back to local
    sockets.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)
      • {on}   (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_multicast_ttl({udp}, {ttl})            *uv.udp_set_multicast_ttl()*
    Set the multicast ttl.

    `ttl` is an integer 1 through 255.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)
      • {ttl}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_source_membership({udp}, {multicast_addr}, {interface_addr}, {source_addr}, {membership})  *uv.udp_set_source_membership()*
    Set membership for a source-specific multicast group. `multicast_addr` is
    multicast address to set membership for. `interface_addr` is interface
    address. `source_addr` is source address. `membership` can be the string
    `"leave"` or `"join"`.

    Parameters: ~
      • {udp}             (`uv.uv_udp_t`)
      • {multicast_addr}  (`string`)
      • {interface_addr}  (`string?`)
      • {source_addr}     (`string`)
      • {membership}      (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_set_ttl({udp}, {ttl})                                *uv.udp_set_ttl()*
    Set the time to live.

    `ttl` is an integer 1 through 255.

    Parameters: ~
      • {udp}  (`uv.uv_udp_t`)
      • {ttl}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_try_send({udp}, {data}, {host}, {port})             *uv.udp_try_send()*
    Same as `uv.udp_send()`, but won't queue a send request if it can't be
    completed immediately.

    `host` and `port` must be provided together. For a connected socket, pass
    explicit `nil` for both.

    Parameters: ~
      • {udp}   (`uv.uv_udp_t`)
      • {data}  (`uv.buffer`)
      • {host}  (`string?`)
      • {port}  (`integer?`)

    Return (multiple): ~
        (`integer?`) bytes_sent
        (`string?`) err
        (`uv.error_name?`) err_name

uv.udp_try_send2({udp}, {messages}, {flags})              *uv.udp_try_send2()*
    Like `uv.udp_try_send()`, but can send multiple datagrams. Lightweight
    abstraction around `sendmmsg(2)`, with a `sendmsg(2)` fallback loop for
    platforms that do not support the former. The `udp` handle must be fully
    initialized, either from a `uv.udp_bind` call, another call that will bind
    automatically (`udp_send`, `udp_try_send`, etc), or from `uv.udp_connect`.

    `messages` should be an array-like table, where `addr` must be specified
    if the `udp` has not been connected via `udp_connect`. Otherwise, `addr`
    must be `nil`.

    `flags` is reserved for future extension and must currently be `nil` or
    `0` or `{}`.

    Returns the number of messages sent successfully. An error will only be
    returned if the first datagram failed to be sent. Example >lua
        -- If client:connect(...) was not called
        local addr = { ip = "127.0.0.1", port = 1234 }
        client:try_send2({
          { data = "Message 1", addr = addr },
          { data = "Message 2", addr = addr },
        })

        -- If client:connect(...) was called
        client:try_send2({
          { data = "Message 1" },
          { data = "Message 2" },
        })
<

    Parameters: ~
      • {udp}       (`uv.uv_udp_t`)
      • {messages}  (`table<integer, { data: uv.buffer, addr: { ip: string, port: integer }? }>`)
      • {flags}     (`0`)

    Return (multiple): ~
        (`integer?`) messages_sent
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:bind({host}, {port}, {flags})                       *uv_udp_t:bind()*
    Bind the UDP handle to an IP address and port. Any `flags` are set with a
    table with fields `reuseaddr`, `ipv6only`, `linux_recverr`, `reuseport`
    equal to `true` or `false`.
    • `reuseaddr`: Indicates if SO_REUSEADDR will be set when binding the
      handle. This sets the SO_REUSEPORT socket flag on the BSDs (except for
      DragonFlyBSD), OS X, and other platforms where SO_REUSEPORTs don't have
      the capability of load balancing, as the opposite of what `reuseport`
      would do. On other Unix platforms, it sets the SO_REUSEADDR flag. What
      that means is that multiple threads or processes can bind to the same
      address without error (provided they all set the flag) but only the last
      one to bind will receive any traffic, in effect "stealing" the port from
      the previous listener.
    • `ipv6only`: Disables dual stack mode.
    • `linux_recverr`: Indicates if IP_RECVERR/IPV6_RECVERR will be set when
      binding the handle. This sets IP_RECVERR for IPv4 and IPV6_RECVERR for
      IPv6 UDP sockets on Linux. This stops the Linux kernel from suppressing
      some ICMP error messages and enables full ICMP error reporting for
      faster failover. This flag is no-op on platforms other than Linux.
    • `reuseport`: Indicates if SO_REUSEPORT will be set when binding the
      handle. This sets the SO_REUSEPORT socket option on supported platforms.
      Unlike `reuseaddr`, this flag will make multiple threads or processes
      that are binding to the same address and port "share" the port, which
      means incoming datagrams are distributed across the receiving sockets
      among threads or processes. This flag is available only on Linux 3.9+,
      DragonFlyBSD 3.6+, FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now.
      Note: The flag `linux_recverr` is only supported with Libuv >= 1.42.0.
      The flag `reuseport` is only supported with Libuv >= 1.49.0.

    Parameters: ~
      • {host}   (`string`)
      • {port}   (`number`)
      • {flags}  (`uv.udp_bind.flags?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:connect({host}, {port})                          *uv_udp_t:connect()*
    Associate the UDP handle to a remote address and port, so every message
    sent by this handle is automatically sent to that destination.

    `host` and `port` must be provided together. Pass explicit `nil` for both
    to disconnect the handle.

    Trying to call `uv.udp_connect()` on an already connected handle will
    result in an `EISCONN` error. Trying to disconnect a handle that is not
    connected will return an `ENOTCONN` error.

    Parameters: ~
      • {host}  (`string?`)
      • {port}  (`integer?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:get_send_queue_count()              *uv_udp_t:get_send_queue_count()*
    Returns the handle's send queue count.

    Return: ~
        (`integer`)

uv_udp_t:get_send_queue_size()                *uv_udp_t:get_send_queue_size()*
    Returns the handle's send queue size.

    Return: ~
        (`integer`)

uv_udp_t:getpeername()                                *uv_udp_t:getpeername()*
    Get the remote IP and port of the UDP handle on connected UDP handles.

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:getsockname()                                *uv_udp_t:getsockname()*
    Get the local IP and port of the UDP handle.

    Return (multiple): ~
        (`uv.socketinfo?`) address
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:open({fd}, {flags})                                 *uv_udp_t:open()*
    Opens an existing file descriptor or Windows SOCKET as a UDP handle.

    Unix only: The only requirement of the sock argument is that it follows
    the datagram contract (works in unconnected mode, supports
    sendmsg()/recvmsg(), etc). In other words, other datagram-type sockets
    like raw sockets or netlink sockets can also be passed to this function.

    The file descriptor is set to non-blocking mode.

    Note: The passed file descriptor or SOCKET is not checked for its type,
    but it's required that it represents a valid datagram socket. Note:
    `flags` is only supported with Libuv >= 1.52.0.

    Parameters: ~
      • {fd}     (`integer`)
      • {flags}  (`integer|{ reuseaddr: boolean?, reuseport: boolean? }?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:recv_start({callback})                        *uv_udp_t:recv_start()*
    Prepare for receiving data. If the socket has not previously been bound
    with `uv.udp_bind()` it is bound to `0.0.0.0` (the "all interfaces" IPv4
    address) and a random port number.

    See |luv-constants| for supported address `family` output values.

    Parameters: ~
      • {callback}  (`uv.udp_recv_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:recv_stop()                                    *uv_udp_t:recv_stop()*
    Stop listening for incoming datagrams.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:send({data}, {host}, {port}, {callback})            *uv_udp_t:send()*
    Send data over the UDP socket. If the socket has not previously been bound
    with `uv.udp_bind()` it will be bound to `0.0.0.0` (the "all interfaces"
    IPv4 address) and a random port number.

    `host` and `port` must be provided together. For a connected socket, pass
    explicit `nil` for both.

    Parameters: ~
      • {data}      (`uv.buffer`)
      • {host}      (`string?`)
      • {port}      (`integer?`)
      • {callback}  (`fun(err: string?)?`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_broadcast({on})                        *uv_udp_t:set_broadcast()*
    Set broadcast on or off.

    Parameters: ~
      • {on}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_membership({multicast_addr}, {interface_addr}, {membership})  *uv_udp_t:set_membership()*
    Set membership for a multicast address. `multicast_addr` is multicast
    address to set membership for. `interface_addr` is interface address.
    `membership` can be the string `"leave"` or `"join"`.

    Parameters: ~
      • {multicast_addr}  (`string`)
      • {interface_addr}  (`string?`)
      • {membership}      (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_multicast_interface({interface_addr})  *uv_udp_t:set_multicast_interface()*
    Set the multicast interface to send or receive data on.

    Parameters: ~
      • {interface_addr}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_multicast_loop({on})              *uv_udp_t:set_multicast_loop()*
    Set IP multicast loop flag. Makes multicast packets loop back to local
    sockets.

    Parameters: ~
      • {on}  (`boolean`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_multicast_ttl({ttl})               *uv_udp_t:set_multicast_ttl()*
    Set the multicast ttl.

    `ttl` is an integer 1 through 255.

    Parameters: ~
      • {ttl}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_source_membership({multicast_addr}, {interface_addr}, {source_addr}, {membership})  *uv_udp_t:set_source_membership()*
    Set membership for a source-specific multicast group. `multicast_addr` is
    multicast address to set membership for. `interface_addr` is interface
    address. `source_addr` is source address. `membership` can be the string
    `"leave"` or `"join"`.

    Parameters: ~
      • {multicast_addr}  (`string`)
      • {interface_addr}  (`string?`)
      • {source_addr}     (`string`)
      • {membership}      (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:set_ttl({ttl})                                   *uv_udp_t:set_ttl()*
    Set the time to live.

    `ttl` is an integer 1 through 255.

    Parameters: ~
      • {ttl}  (`integer`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:try_send({data}, {host}, {port})                *uv_udp_t:try_send()*
    Same as `uv.udp_send()`, but won't queue a send request if it can't be
    completed immediately.

    `host` and `port` must be provided together. For a connected socket, pass
    explicit `nil` for both.

    Parameters: ~
      • {data}  (`uv.buffer`)
      • {host}  (`string?`)
      • {port}  (`integer?`)

    Return (multiple): ~
        (`integer?`) bytes_sent
        (`string?`) err
        (`uv.error_name?`) err_name

uv_udp_t:try_send2({messages}, {flags})                 *uv_udp_t:try_send2()*
    Like `uv.udp_try_send()`, but can send multiple datagrams. Lightweight
    abstraction around `sendmmsg(2)`, with a `sendmsg(2)` fallback loop for
    platforms that do not support the former. The `udp` handle must be fully
    initialized, either from a `uv.udp_bind` call, another call that will bind
    automatically (`udp_send`, `udp_try_send`, etc), or from `uv.udp_connect`.

    `messages` should be an array-like table, where `addr` must be specified
    if the `udp` has not been connected via `udp_connect`. Otherwise, `addr`
    must be `nil`.

    `flags` is reserved for future extension and must currently be `nil` or
    `0` or `{}`.

    Returns the number of messages sent successfully. An error will only be
    returned if the first datagram failed to be sent. Example >lua
        -- If client:connect(...) was not called
        local addr = { ip = "127.0.0.1", port = 1234 }
        client:try_send2({
          { data = "Message 1", addr = addr },
          { data = "Message 2", addr = addr },
        })

        -- If client:connect(...) was called
        client:try_send2({
          { data = "Message 1" },
          { data = "Message 2" },
        })
<

    Parameters: ~
      • {messages}  (`table<integer, { data: uv.buffer, addr: { ip: string, port: integer }? }>`)
      • {flags}     (`0`)

    Return (multiple): ~
        (`integer?`) messages_sent
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_fs_event_t` - FS Event handle                        *luv-fs-event-handle*

uv.fs_event_start.flags                              *uv.fs_event_start.flags*

    Fields: ~
      • {recursive}    (`boolean?`)
      • {stat}         (`boolean?`)
      • {watch_entry}  (`boolean?`)

uv.uv_fs_event_t                            *uv.uv_fs_event_t* *uv_fs_event_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    FS Event handles allow the user to monitor a given path for changes, for
    example, if the file was renamed or there was a generic change in it. This
    handle uses the best backend for the job on each platform.

    Fields: ~
      • {getpath}  (`fun(self: uv.uv_fs_event_t): string?, string?, uv.error_name?`)
                   See |uv_fs_event_t:getpath()|.
      • {start}    (`fun(self: uv.uv_fs_event_t, path: string, flags: uv.fs_event_start.flags, callback: uv.fs_event_start.callback): 0?, string?, uv.error_name?`)
                   See |uv_fs_event_t:start()|.
      • {stop}     (`fun(self: uv.uv_fs_event_t): 0?, string?, uv.error_name?`)
                   See |uv_fs_event_t:stop()|.


uv.fs_event_getpath({fs_event})                        *uv.fs_event_getpath()*
    Get the path being monitored by the handle.

    Parameters: ~
      • {fs_event}  (`uv.uv_fs_event_t`)

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_event_start({fs_event}, {path}, {flags}, {callback})  *uv.fs_event_start()*
    Start the handle with the given callback, which will watch the specified
    path for changes.

    Parameters: ~
      • {fs_event}  (`uv.uv_fs_event_t`)
      • {path}      (`string`)
      • {flags}     (`uv.fs_event_start.flags`)
      • {callback}  (`uv.fs_event_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_event_stop({fs_event})                              *uv.fs_event_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {fs_event}  (`uv.uv_fs_event_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_fs_event()                                          *uv.new_fs_event()*
    Creates and initializes a new `uv_fs_event_t`. Returns the Lua userdata
    wrapping it.

    Return (multiple): ~
        (`uv.uv_fs_event_t?`) fs_event
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_event_t:getpath()                              *uv_fs_event_t:getpath()*
    Get the path being monitored by the handle.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_event_t:start({path}, {flags}, {callback})       *uv_fs_event_t:start()*
    Start the handle with the given callback, which will watch the specified
    path for changes.

    Parameters: ~
      • {path}      (`string`)
      • {flags}     (`uv.fs_event_start.flags`)
      • {callback}  (`uv.fs_event_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_event_t:stop()                                    *uv_fs_event_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
`uv_fs_poll_t` - FS Poll handle                           *luv-fs-poll-handle*

uv.uv_fs_poll_t                               *uv.uv_fs_poll_t* *uv_fs_poll_t*
    Extends: |uv.uv_handle_t|

    |uv_handle_t| functions also apply.

    FS Poll handles allow the user to monitor a given path for changes. Unlike
    `uv_fs_event_t`, fs poll handles use `stat` to detect when a file has
    changed so they can work on file systems where fs event handles can't.

    Fields: ~
      • {getpath}  (`fun(self: uv.uv_fs_poll_t): string?, string?, uv.error_name?`)
                   See |uv_fs_poll_t:getpath()|.
      • {start}    (`fun(self: uv.uv_fs_poll_t, path: string, interval: integer, callback: uv.fs_poll_start.callback): 0?, string?, uv.error_name?`)
                   See |uv_fs_poll_t:start()|.
      • {stop}     (`fun(self: uv.uv_fs_poll_t): 0?, string?, uv.error_name?`)
                   See |uv_fs_poll_t:stop()|.


uv.fs_poll_getpath({fs_poll})                           *uv.fs_poll_getpath()*
    Get the path being monitored by the handle.

    Parameters: ~
      • {fs_poll}  (`uv.uv_fs_poll_t`)

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_poll_start({fs_poll}, {path}, {interval}, {callback})  *uv.fs_poll_start()*
    Check the file at `path` for changes every `interval` milliseconds.

    Note: For maximum portability, use multi-second intervals. Sub-second
    intervals will not detect all changes on many file systems.

    Parameters: ~
      • {fs_poll}   (`uv.uv_fs_poll_t`)
      • {path}      (`string`)
      • {interval}  (`integer`)
      • {callback}  (`uv.fs_poll_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_poll_stop({fs_poll})                                 *uv.fs_poll_stop()*
    Stop the handle, the callback will no longer be called.

    Parameters: ~
      • {fs_poll}  (`uv.uv_fs_poll_t`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_fs_poll()                                            *uv.new_fs_poll()*
    Creates and initializes a new `uv_fs_poll_t`. Returns the Lua userdata
    wrapping it.

    Return (multiple): ~
        (`uv.uv_fs_poll_t?`) fs_poll
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_poll_t:getpath()                                *uv_fs_poll_t:getpath()*
    Get the path being monitored by the handle.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_poll_t:start({path}, {interval}, {callback})      *uv_fs_poll_t:start()*
    Check the file at `path` for changes every `interval` milliseconds.

    Note: For maximum portability, use multi-second intervals. Sub-second
    intervals will not detect all changes on many file systems.

    Parameters: ~
      • {path}      (`string`)
      • {interval}  (`integer`)
      • {callback}  (`uv.fs_poll_start.callback`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv_fs_poll_t:stop()                                      *uv_fs_poll_t:stop()*
    Stop the handle, the callback will no longer be called.

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
File system operations                            *luv-file-system-operations*

Most file system functions can operate synchronously or asynchronously. When a
synchronous version is called (by omitting a callback), the function will
immediately return the results of the FS call. When an asynchronous version is
called (by providing a callback), the function will immediately return a
`uv_fs_t userdata` and asynchronously execute its callback; if an error is
encountered, the first and only argument passed to the callback will be the
`err` error string; if the operation completes successfully, the first
argument will be `nil` and the remaining arguments will be the results of the
FS call.

Synchronous and asynchronous versions of `readFile` (with naive error
handling) are implemented below as an example: >lua
    local function readFileSync(path)
      local fd = assert(uv.fs_open(path, "r", 438))
      local stat = assert(uv.fs_fstat(fd))
      local data = assert(uv.fs_read(fd, stat.size, 0))
      assert(uv.fs_close(fd))
      return data
    end

    local data = readFileSync("main.lua")
    print("synchronous read", data)
< >lua
    local function readFile(path, callback)
      uv.fs_open(path, "r", 438, function(err, fd)
        assert(not err, err)
        uv.fs_fstat(fd, function(err, stat)
          assert(not err, err)
          uv.fs_read(fd, stat.size, 0, function(err, data)
            assert(not err, err)
            uv.fs_close(fd, function(err)
              assert(not err, err)
              return callback(data)
            end)
          end)
        end)
      end)
    end

    readFile("main.lua", function(data)
      print("asynchronous read", data)
    end)
<


uv.fs_copyfile.flags                                    *uv.fs_copyfile.flags*

    Fields: ~
      • {excl}           (`boolean?`)
      • {ficlone}        (`boolean?`)
      • {ficlone_force}  (`boolean?`)

uv.fs_stat.result                                          *uv.fs_stat.result*

    Fields: ~
      • {atime}      (`uv.fs_stat.result.time`)
      • {birthtime}  (`uv.fs_stat.result.time`)
      • {blksize}    (`integer`)
      • {blocks}     (`integer`)
      • {ctime}      (`uv.fs_stat.result.time`)
      • {dev}        (`integer`)
      • {flags}      (`integer`)
      • {gen}        (`integer`)
      • {gid}        (`integer`)
      • {ino}        (`integer`)
      • {mode}       (`integer`)
      • {mtime}      (`uv.fs_stat.result.time`)
      • {nlink}      (`integer`)
      • {rdev}       (`integer`)
      • {size}       (`integer`)
      • {type}       (`string?`)
      • {uid}        (`integer`)

uv.fs_stat.result.time                                *uv.fs_stat.result.time*

    Fields: ~
      • {nsec}  (`integer`)
      • {sec}   (`integer`)

uv.fs_statfs.result                                      *uv.fs_statfs.result*

    Fields: ~
      • {bavail}  (`integer`)
      • {bfree}   (`integer`)
      • {blocks}  (`integer`)
      • {bsize}   (`integer`)
      • {ffree}   (`integer`)
      • {files}   (`integer`)
      • {frsize}  (`integer?`)
      • {type}    (`integer`)

uv.luv_dir_t                                                    *uv.luv_dir_t*
    Extends: `userdata`


    Fields: ~
      • {closedir}  (`fun(self: uv.luv_dir_t, callback: nil?): boolean?, string?, uv.error_name?`)
                    See |luv_dir_t:closedir()|.
      • {readdir}   (`fun(self: uv.luv_dir_t, callback: nil?): table<integer, { name: string, type: string? }>?, string?, uv.error_name?`)
                    See |luv_dir_t:readdir()|.


luv_dir_t:closedir({callback})                          *luv_dir_t:closedir()*
    Closes a directory stream returned by a successful `uv.fs_opendir()` call.

    Parameters: ~
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(self: uv.luv_dir_t, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

luv_dir_t:readdir({callback})                            *luv_dir_t:readdir()*
    Iterates over the directory stream `luv_dir_t` returned by a successful
    `uv.fs_opendir()` call. A table of data tables is returned where the
    number of entries `n` is equal to or less than the `entries` parameter
    used in the associated `uv.fs_opendir()` call.

    Parameters: ~
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(self: uv.luv_dir_t, callback: fun(err: string?, entries: table<integer, { name: string, type: string? }>?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`table<integer, { name: string, type: string? }>?`) entries
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_access({path}, {mode}, {callback})                      *uv.fs_access()*
    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.

    Parameters: ~
      • {path}      (`string`)
      • {mode}      (`string|integer`) (a combination of the `'r'`, `'w'` and
                    `'x'` characters denoting the symbolic mode as per
                    `chmod(1)`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, mode: string|integer, callback: fun(err: string?, permission: boolean?)): uv.uv_fs_t`

    Return (multiple): ~
        (`boolean?`) permission
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_chmod({path}, {mode}, {callback})                        *uv.fs_chmod()*
    Equivalent to `chmod(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {mode}      (`integer`) (octal `chmod(1)` mode, e.g.
                    `tonumber('644', 8)`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, mode: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_chown({path}, {uid}, {gid}, {callback})                  *uv.fs_chown()*
    Equivalent to `chown(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {uid}       (`integer`)
      • {gid}       (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, uid: integer, gid: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_close({fd}, {callback})                                  *uv.fs_close()*
    Equivalent to `close(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_closedir({dir}, {callback})                           *uv.fs_closedir()*
    Closes a directory stream returned by a successful `uv.fs_opendir()` call.

    Parameters: ~
      • {dir}       (`uv.luv_dir_t`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(dir: uv.luv_dir_t, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_copyfile({path}, {new_path}, {flags}, {callback})     *uv.fs_copyfile()*
    Copies a file from path to new_path. If the `flags` parameter is omitted,
    then the 3rd parameter will be treated as the `callback`.

    Parameters: ~
      • {path}      (`string`)
      • {new_path}  (`string`)
      • {flags}     (`integer|uv.fs_copyfile.flags?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, new_path: string, flags: integer|uv.fs_copyfile.flags?, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`
      • `fun(path: string, new_path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_fchmod({fd}, {mode}, {callback})                        *uv.fs_fchmod()*
    Equivalent to `fchmod(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {mode}      (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, mode: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_fchown({fd}, {uid}, {gid}, {callback})                  *uv.fs_fchown()*
    Equivalent to `fchown(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {uid}       (`integer`)
      • {gid}       (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, uid: integer, gid: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_fdatasync({fd}, {callback})                          *uv.fs_fdatasync()*
    Equivalent to `fdatasync(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_fstat({fd}, {callback})                                  *uv.fs_fstat()*
    Equivalent to `fstat(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, callback: fun(err: string?, stat: uv.fs_stat.result?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.fs_stat.result?`) stat
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_fsync({fd}, {callback})                                  *uv.fs_fsync()*
    Equivalent to `fsync(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_ftruncate({fd}, {offset}, {callback})                *uv.fs_ftruncate()*
    Equivalent to `ftruncate(2)`.

    Parameters: ~
      • {fd}        (`integer`)
      • {offset}    (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, offset: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_futime({fd}, {atime}, {mtime}, {callback})              *uv.fs_futime()*
    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.

    Parameters: ~
      • {fd}        (`integer`)
      • {atime}     (`number|string?`)
      • {mtime}     (`number|string?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, atime: number|string?, mtime: number|string?, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_lchown({path}, {uid}, {gid}, {callback})                *uv.fs_lchown()*
    Equivalent to `lchown(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {uid}       (`integer`)
      • {gid}       (`integer`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, uid: integer, gid: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_link({path}, {new_path}, {callback})                      *uv.fs_link()*
    Equivalent to `link(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {new_path}  (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, new_path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_lstat({path}, {callback})                                *uv.fs_lstat()*
    Equivalent to `lstat(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, stat: uv.fs_stat.result?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.fs_stat.result?`) stat
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_lutime({path}, {atime}, {mtime}, {callback})            *uv.fs_lutime()*
    Equivalent to `lutimes(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.

    Parameters: ~
      • {path}      (`string`)
      • {atime}     (`number|string?`)
      • {mtime}     (`number|string?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, atime: number|string?, mtime: number|string?, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_mkdir({path}, {mode}, {callback})                        *uv.fs_mkdir()*
    Equivalent to `mkdir(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {mode}      (`integer`) (octal `chmod(1)` mode, e.g.
                    `tonumber('755', 8)`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, mode: integer, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_mkdtemp({template}, {callback})                        *uv.fs_mkdtemp()*
    Equivalent to `mkdtemp(3)`.

    Parameters: ~
      • {template}  (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(template: string, callback: fun(err: string?, path: string?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_mkstemp({template}, {callback})                        *uv.fs_mkstemp()*
    Equivalent to `mkstemp(3)`. Returns a temporary file handle and filename.

    Parameters: ~
      • {template}  (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(template: string, callback: uv.fs_mkstemp.callback): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`integer?`) fd
        (`string`) path_or_err
        (`uv.error_name?`) err_name

uv.fs_open({path}, {flags}, {mode}, {callback})                 *uv.fs_open()*
    Equivalent to `open(2)`. Access `flags` may be an integer or one of:
    `"r"`, `"rs"`, `"sr"`, `"r+"`, `"rs+"`, `"sr+"`, `"w"`, `"wx"`, `"xw"`,
    `"w+"`, `"wx+"`, `"xw+"`, `"a"`, `"ax"`, `"xa"`, `"a+"`, `"ax+"`, or
    "`xa+`". 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.

    Parameters: ~
      • {path}      (`string`)
      • {flags}     (`string|integer`)
      • {mode}      (`integer`) (octal `chmod(1)` mode, e.g.
                    `tonumber('644', 8)`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, flags: string|integer, mode: integer, callback: fun(err: string?, fd: integer?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`integer?`) fd
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_opendir({path}, {callback}, {entries})                 *uv.fs_opendir()*
    Opens path as a directory stream. Returns a handle that the user can pass
    to `uv.fs_readdir()`. The `entries` parameter defines the maximum number
    of entries that should be returned by each call to `uv.fs_readdir()`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)
      • {entries}   (`integer?`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, dir: uv.luv_dir_t?), entries: integer?): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.luv_dir_t?`) dir
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_read({fd}, {size}, {offset}, {callback})                  *uv.fs_read()*
    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.

    Parameters: ~
      • {fd}        (`integer`)
      • {size}      (`integer`)
      • {offset}    (`integer?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, size: integer, offset: integer?, callback: fun(err: string?, data: string?)): uv.uv_fs_t?, string?, uv.error_name?`
      • `fun(fd: integer, size: integer, callback: fun(err: string?, data: string?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`string?`) data
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_readdir({dir}, {callback})                             *uv.fs_readdir()*
    Iterates over the directory stream `luv_dir_t` returned by a successful
    `uv.fs_opendir()` call. A table of data tables is returned where the
    number of entries `n` is equal to or less than the `entries` parameter
    used in the associated `uv.fs_opendir()` call.

    Parameters: ~
      • {dir}       (`uv.luv_dir_t`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(dir: uv.luv_dir_t, callback: fun(err: string?, entries: table<integer, { name: string, type: string? }>?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`table<integer, { name: string, type: string? }>?`) entries
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_readlink({path}, {callback})                          *uv.fs_readlink()*
    Equivalent to `readlink(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, path: string?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_realpath({path}, {callback})                          *uv.fs_realpath()*
    Equivalent to `realpath(3)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, path: string?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_rename({path}, {new_path}, {callback})                  *uv.fs_rename()*
    Equivalent to `rename(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {new_path}  (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, new_path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_rmdir({path}, {callback})                                *uv.fs_rmdir()*
    Equivalent to `rmdir(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_scandir({path}, {callback})                            *uv.fs_scandir()*
    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.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`fun(err: string?, success: uv.uv_fs_t?)?`)

    Return (multiple): ~
        (`uv.uv_fs_t?`) handle
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_scandir_next({fs})                                *uv.fs_scandir_next()*
    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.

    Parameters: ~
      • {fs}  (`uv.uv_fs_t`)

    Return (multiple): ~
        (`string?`) name
        (`string?`) type_or_err
        (`uv.error_name?`) err_name

uv.fs_sendfile({out_fd}, {in_fd}, {in_offset}, {size}, {callback})  *uv.fs_sendfile()*
    Limited equivalent to `sendfile(2)`. Returns the number of bytes written.

    Parameters: ~
      • {out_fd}     (`integer`)
      • {in_fd}      (`integer`)
      • {in_offset}  (`integer`)
      • {size}       (`integer`)
      • {callback}   (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(out_fd: integer, in_fd: integer, in_offset: integer, size: integer, callback: fun(err: string?, bytes: integer?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`integer?`) bytes
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_stat({path}, {callback})                                  *uv.fs_stat()*
    Equivalent to `stat(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, stat: uv.fs_stat.result?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.fs_stat.result?`) stat
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_statfs({path}, {callback})                              *uv.fs_statfs()*
    Equivalent to `statfs(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, stat: uv.fs_statfs.result?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.fs_statfs.result?`) stat
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_symlink({path}, {new_path}, {flags}, {callback})       *uv.fs_symlink()*
    Equivalent to `symlink(2)`. If the `flags` parameter is omitted, then the
    3rd parameter will be treated as the `callback`.

    Parameters: ~
      • {path}      (`string`)
      • {new_path}  (`string`)
      • {flags}     (`integer|{ dir: boolean?, junction: boolean? }?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, new_path: string, flags: integer|{ dir: boolean?, junction: boolean? }?, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`
      • `fun(path: string, new_path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_unlink({path}, {callback})                              *uv.fs_unlink()*
    Equivalent to `unlink(2)`.

    Parameters: ~
      • {path}      (`string`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_utime({path}, {atime}, {mtime}, {callback})              *uv.fs_utime()*
    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.

    Parameters: ~
      • {path}      (`string`)
      • {atime}     (`number|string?`)
      • {mtime}     (`number|string?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(path: string, atime: number|string?, mtime: number|string?, callback: fun(err: string?, success: boolean?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.fs_write({fd}, {data}, {offset}, {callback})                *uv.fs_write()*
    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.

    Parameters: ~
      • {fd}        (`integer`)
      • {data}      (`uv.buffer`)
      • {offset}    (`integer?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(fd: integer, data: uv.buffer, offset: integer?, callback: fun(err: string?, bytes: integer?)): uv.uv_fs_t?, string?, uv.error_name?`
      • `fun(fd: integer, data: uv.buffer, callback: fun(err: string?, bytes: integer?)): uv.uv_fs_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`integer?`) bytes_written
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
Thread pool work scheduling                  *luv-thread-pool-work-scheduling*

Libuv provides a threadpool which can be used to run user code and get
notified in the loop thread. This threadpool is internally used to run all
file system operations, as well as `getaddrinfo` and `getnameinfo` requests. >lua
    local function work_callback(a, b)
      return a + b
    end

    local function after_work_callback(c)
      print("The result is: " .. c)
    end

    local work = uv.new_work(work_callback, after_work_callback)

    work:queue(1, 2)

    -- output: "The result is: 3"
<


uv.luv_work_ctx_t                                          *uv.luv_work_ctx_t*
    Extends: `userdata`


    Fields: ~
      • {queue}  (`fun(self: uv.luv_work_ctx_t, ...: uv.threadargs): boolean?, string?, uv.error_name?`)
                 See |luv_work_ctx_t:queue()|.


luv_work_ctx_t:queue({...})                           *luv_work_ctx_t:queue()*
    Queues a work request which will run `work_callback` in a new Lua state in
    a thread from the threadpool with any additional arguments from `...`.
    Values returned from `work_callback` are passed to `after_work_callback`,
    which is called in the main loop thread.

    Parameters: ~
      • {...}  (`uv.threadargs`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_work({work_callback}, {after_work_callback})            *uv.new_work()*
    Creates and initializes a new `luv_work_ctx_t` (not `uv_work_t`).
    `work_callback` is a Lua function or a string containing Lua code or
    bytecode dumped from a function. Returns the Lua userdata wrapping it.

    Parameters: ~
      • {work_callback}        (`string|fun(...: uv.threadargs)`)
      • {after_work_callback}  (`fun(...: uv.threadargs)`)

    Return: ~
        (`uv.luv_work_ctx_t`)

uv.queue_work({work_ctx}, {...})                             *uv.queue_work()*
    Queues a work request which will run `work_callback` in a new Lua state in
    a thread from the threadpool with any additional arguments from `...`.
    Values returned from `work_callback` are passed to `after_work_callback`,
    which is called in the main loop thread.

    Parameters: ~
      • {work_ctx}  (`uv.luv_work_ctx_t`)
      • {...}       (`uv.threadargs`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
DNS utility functions                              *luv-dns-utility-functions*

uv.getaddrinfo.hints                                    *uv.getaddrinfo.hints*

    Fields: ~
      • {addrconfig}   (`boolean?`)
      • {all}          (`boolean?`)
      • {canonname}    (`boolean?`)
      • {family}       (`string|integer?`)
      • {numerichost}  (`boolean?`)
      • {numericserv}  (`boolean?`)
      • {passive}      (`boolean?`)
      • {protocol}     (`string|integer?`)
      • {socktype}     (`string|integer?`)
      • {v4mapped}     (`boolean?`)

uv.getnameinfo.address                                *uv.getnameinfo.address*

    Fields: ~
      • {family}  (`string|integer?`)
      • {ip}      (`string?`)
      • {port}    (`integer?`)


uv.getaddrinfo({node}, {service}, {hints}, {callback})      *uv.getaddrinfo()*
    Equivalent to `getaddrinfo(3)`. Either `node` or `service` may be `nil`
    but not both.

    See |luv-constants| for supported address `family` input and output
    values.

    See |luv-constants| for supported `socktype` input and output values.

    When `protocol` is set to 0 or nil, it will be automatically chosen based
    on the socket's domain and type. When `protocol` is specified as a string,
    it will be looked up using the `getprotobyname(3)` function. Examples:
    `"ip"`, `"icmp"`, `"tcp"`, `"udp"`, etc.

    Parameters: ~
      • {node}      (`string?`)
      • {service}   (`string?`)
      • {hints}     (`uv.getaddrinfo.hints?`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(node: string?, service: string?, hints: uv.getaddrinfo.hints?, callback: fun(err: string?, addresses: table<integer, uv.address>?)): uv.uv_getaddrinfo_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`table<integer, uv.address>?`) addresses
        (`string?`) err
        (`uv.error_name?`) err_name

uv.getnameinfo({address}, {callback})                       *uv.getnameinfo()*
    Equivalent to `getnameinfo(3)`.

    See |luv-constants| for supported address `family` input values.

    Parameters: ~
      • {address}   (`uv.getnameinfo.address`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun(address: uv.getnameinfo.address, callback: uv.getnameinfo.callback): uv.uv_getnameinfo_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`string?`) host
        (`string`) service_or_err
        (`uv.error_name?`) err_name


==============================================================================
Threading and synchronization utilities *luv-threading-and-synchronization-utilities*

Libuv provides cross-platform implementations for multiple threading and
synchronization primitives. The API largely follows the pthreads API.


uv.luv_sem_t                                                    *uv.luv_sem_t*
    Extends: `userdata`


    Fields: ~
      • {post}     (`fun(self: uv.luv_sem_t)`) See |luv_sem_t:post()|.
      • {trywait}  (`fun(self: uv.luv_sem_t): boolean`) See
                   |luv_sem_t:trywait()|.
      • {wait}     (`fun(self: uv.luv_sem_t)`) See |luv_sem_t:wait()|.

uv.luv_thread_t                                              *uv.luv_thread_t*
    Extends: `userdata`


    Fields: ~
      • {detach}       (`fun(self: uv.luv_thread_t): boolean?, string?, uv.error_name?`)
                       See |luv_thread_t:detach()|.
      • {equal}        (`fun(self: uv.luv_thread_t, other_thread: uv.luv_thread_t): boolean`)
                       See |luv_thread_t:equal()|.
      • {getaffinity}  (`fun(self: uv.luv_thread_t, mask_size: integer?): table<integer, boolean>?, string?, uv.error_name?`)
                       See |luv_thread_t:getaffinity()|.
      • {getname}      (`fun(self: uv.luv_thread_t): string?, string?, uv.error_name?`)
                       See |luv_thread_t:getname()|.
      • {getpriority}  (`fun(self: uv.luv_thread_t): integer?, string?, uv.error_name?`)
                       See |luv_thread_t:getpriority()|.
      • {join}         (`fun(self: uv.luv_thread_t): boolean?, string?, uv.error_name?`)
                       See |luv_thread_t:join()|.
      • {setaffinity}  (`fun(self: uv.luv_thread_t, affinity: table<integer, boolean>, get_old_affinity: boolean?): table<integer, boolean>|boolean?, string?, uv.error_name?`)
                       See |luv_thread_t:setaffinity()|.
      • {setpriority}  (`fun(self: uv.luv_thread_t, priority: integer): boolean?, string?, uv.error_name?`)
                       See |luv_thread_t:setpriority()|.


luv_sem_t:post()                                            *luv_sem_t:post()*
    Increments (unlocks) a semaphore, if the semaphore's value consequently
    becomes greater than zero then another thread blocked in a sem_wait call
    will be woken and proceed to decrement the semaphore.

luv_sem_t:trywait()                                      *luv_sem_t:trywait()*
    The same as `uv.sem_wait()` but returns immediately if the semaphore is
    not available.

    If the semaphore's value was decremented then `true` is returned,
    otherwise the semaphore has a value of zero and `false` is returned.

    Return: ~
        (`boolean`)

luv_sem_t:wait()                                            *luv_sem_t:wait()*
    Decrements (locks) a semaphore, if the semaphore's value is greater than
    zero then the value is decremented and the call returns immediately. If
    the semaphore's value is zero then the call blocks until the semaphore's
    value rises above zero or the call is interrupted by a signal.

luv_thread_t:detach()                                  *luv_thread_t:detach()*
    Detaches a thread. Detached threads automatically release their resources
    upon termination, eliminating the need for the application to call
    `uv.thread_join`.

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:equal({other_thread})                      *luv_thread_t:equal()*
    Returns a boolean indicating whether two threads are the same. This
    function is equivalent to the `__eq` metamethod.

    Parameters: ~
      • {other_thread}  (`uv.luv_thread_t`)

    Return: ~
        (`boolean`)

luv_thread_t:getaffinity({mask_size})             *luv_thread_t:getaffinity()*
    Gets the specified thread's affinity setting.

    If `mask_size` is provided, it must be greater than or equal to
    `uv.cpumask_size()`. If the `mask_size` parameter is omitted, then the
    return of `uv.cpumask_size()` will be used. Returns an array-like table
    where each of the keys correspond to a CPU number and the values are
    booleans that represent whether the `thread` is eligible to run on that
    CPU.

    Note: Thread affinity getting is not atomic on Windows. Unsupported on
    macOS.

    Parameters: ~
      • {mask_size}  (`integer?`)

    Return (multiple): ~
        (`table<integer, boolean>?`) affinity
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:getname()                                *luv_thread_t:getname()*
    Gets the name of the thread specified by `thread`.

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:getpriority()                        *luv_thread_t:getpriority()*
    Gets the thread's priority setting.

    Retrieves the scheduling priority of the specified thread. The returned
    priority value is platform dependent.

    For Linux, when schedule policy is SCHED_OTHER (default), priority is 0.

    Return (multiple): ~
        (`integer?`) priority
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:join()                                      *luv_thread_t:join()*
    Waits for the `thread` to finish executing its entry function.

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:setaffinity({affinity}, {get_old_affinity})  *luv_thread_t:setaffinity()*
    Sets the specified thread's affinity setting.

    `affinity` must be a table where each of the keys are a CPU number and the
    values are booleans that represent whether the `thread` should be eligible
    to run on that CPU. If the length of the `affinity` table is not greater
    than or equal to `uv.cpumask_size()`, any CPU numbers missing from the
    table will have their affinity set to `false`. If setting the affinity of
    more than `uv.cpumask_size()` CPUs is desired, `affinity` must be an
    array-like table with no gaps, since `#affinity` will be used as the
    `cpumask_size` if it is greater than `uv.cpumask_size()`.

    If `get_old_affinity` is `true`, the previous affinity settings for the
    `thread` will be returned. Otherwise, `true` is returned after a
    successful call.

    Note: Thread affinity setting is not atomic on Windows. Unsupported on
    macOS.

    Parameters: ~
      • {affinity}          (`table<integer, boolean>`)
      • {get_old_affinity}  (`boolean?`)

    Return (multiple): ~
        (`table<integer, boolean>|boolean?`) affinity_or_success
        (`string?`) err
        (`uv.error_name?`) err_name

luv_thread_t:setpriority({priority})              *luv_thread_t:setpriority()*
    Sets the specified thread's scheduling priority setting. It requires
    elevated privilege to set specific priorities on some platforms.

    The priority can be set to the following constants.
    • uv.constants.THREAD_PRIORITY_HIGHEST
    • uv.constants.THREAD_PRIORITY_ABOVE_NORMAL
    • uv.constants.THREAD_PRIORITY_NORMAL
    • uv.constants.THREAD_PRIORITY_BELOW_NORMAL
    • uv.constants.THREAD_PRIORITY_LOWEST

    Parameters: ~
      • {priority}  (`integer`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_sem({value})                                             *uv.new_sem()*
    Creates a new semaphore with the specified initial value. A semaphore is
    safe to share across threads. It represents an unsigned integer value that
    can incremented and decremented atomically but any attempt to make it
    negative will "wait" until the value can be decremented by another thread
    incrementing it.

    The initial value must be a non-negative integer. Note: A semaphore must
    be shared between threads, any `uv.sem_wait()` on a single thread that
    blocks will deadlock.

    Parameters: ~
      • {value}  (`integer?`)

    Return (multiple): ~
        (`uv.luv_sem_t?`) sem
        (`string?`) err
        (`uv.error_name?`) err_name

uv.new_thread({options}, {entry}, {...})                     *uv.new_thread()*
    Creates and initializes a `luv_thread_t` (not `uv_thread_t`). Returns the
    Lua userdata wrapping it and asynchronously executes `entry`, which can be
    either a Lua function or a string containing Lua code or bytecode dumped
    from a function. Additional arguments `...` are passed to the `entry`
    function and an optional `options` table may be provided. Currently
    accepted `option` fields are `stack_size`. Note: unsafe, please make sure
    the thread end of life before Lua state close.

    Parameters: ~
      • {options}  (`{ stack_size: integer? }`)
      • {entry}    (`function|string`)
      • {...}      (`uv.threadargs`) passed to `entry`

    Overloads: ~
      • `fun(entry: function|string, ...: uv.threadargs): uv.luv_thread_t?, string?, uv.error_name?`

    Return (multiple): ~
        (`uv.luv_thread_t?`) thread
        (`string?`) err
        (`uv.error_name?`) err_name

uv.sem_post({sem})                                             *uv.sem_post()*
    Increments (unlocks) a semaphore, if the semaphore's value consequently
    becomes greater than zero then another thread blocked in a sem_wait call
    will be woken and proceed to decrement the semaphore.

    Parameters: ~
      • {sem}  (`uv.luv_sem_t`)

uv.sem_trywait({sem})                                       *uv.sem_trywait()*
    The same as `uv.sem_wait()` but returns immediately if the semaphore is
    not available.

    If the semaphore's value was decremented then `true` is returned,
    otherwise the semaphore has a value of zero and `false` is returned.

    Parameters: ~
      • {sem}  (`uv.luv_sem_t`)

    Return: ~
        (`boolean`)

uv.sem_wait({sem})                                             *uv.sem_wait()*
    Decrements (locks) a semaphore, if the semaphore's value is greater than
    zero then the value is decremented and the call returns immediately. If
    the semaphore's value is zero then the call blocks until the semaphore's
    value rises above zero or the call is interrupted by a signal.

    Parameters: ~
      • {sem}  (`uv.luv_sem_t`)

uv.sleep({msec})                                                  *uv.sleep()*
    Pauses the thread in which this is called for a number of milliseconds.

    Parameters: ~
      • {msec}  (`integer`)

uv.thread_detach({thread})                                *uv.thread_detach()*
    Detaches a thread. Detached threads automatically release their resources
    upon termination, eliminating the need for the application to call
    `uv.thread_join`.

    Parameters: ~
      • {thread}  (`uv.luv_thread_t`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_equal({thread}, {other_thread})                  *uv.thread_equal()*
    Returns a boolean indicating whether two threads are the same. This
    function is equivalent to the `__eq` metamethod.

    Parameters: ~
      • {thread}        (`uv.luv_thread_t`)
      • {other_thread}  (`uv.luv_thread_t`)

    Return: ~
        (`boolean`)

uv.thread_getaffinity({thread}, {mask_size})         *uv.thread_getaffinity()*
    Gets the specified thread's affinity setting.

    If `mask_size` is provided, it must be greater than or equal to
    `uv.cpumask_size()`. If the `mask_size` parameter is omitted, then the
    return of `uv.cpumask_size()` will be used. Returns an array-like table
    where each of the keys correspond to a CPU number and the values are
    booleans that represent whether the `thread` is eligible to run on that
    CPU.

    Note: Thread affinity getting is not atomic on Windows. Unsupported on
    macOS.

    Parameters: ~
      • {thread}     (`uv.luv_thread_t`)
      • {mask_size}  (`integer?`)

    Return (multiple): ~
        (`table<integer, boolean>?`) affinity
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_getcpu()                                        *uv.thread_getcpu()*
    Gets the CPU number on which the calling thread is running.

    Note: The first CPU will be returned as the number 1, not 0. This allows
    for the number to correspond with the table keys used in
    `uv.thread_getaffinity` and `uv.thread_setaffinity`.

    Return (multiple): ~
        (`integer?`) cpu
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_getname({thread})                              *uv.thread_getname()*
    Gets the name of the thread specified by `thread`.

    Parameters: ~
      • {thread}  (`uv.luv_thread_t`)

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_getpriority({thread})                      *uv.thread_getpriority()*
    Gets the thread's priority setting.

    Retrieves the scheduling priority of the specified thread. The returned
    priority value is platform dependent.

    For Linux, when schedule policy is SCHED_OTHER (default), priority is 0.

    Parameters: ~
      • {thread}  (`uv.luv_thread_t`)

    Return (multiple): ~
        (`integer?`) priority
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_join({thread})                                    *uv.thread_join()*
    Waits for the `thread` to finish executing its entry function.

    Parameters: ~
      • {thread}  (`uv.luv_thread_t`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_self()                                            *uv.thread_self()*
    Returns the handle for the thread in which this is called.

    Return: ~
        (`uv.luv_thread_t`)

uv.thread_setaffinity({thread}, {affinity}, {get_old_affinity})  *uv.thread_setaffinity()*
    Sets the specified thread's affinity setting.

    `affinity` must be a table where each of the keys are a CPU number and the
    values are booleans that represent whether the `thread` should be eligible
    to run on that CPU. If the length of the `affinity` table is not greater
    than or equal to `uv.cpumask_size()`, any CPU numbers missing from the
    table will have their affinity set to `false`. If setting the affinity of
    more than `uv.cpumask_size()` CPUs is desired, `affinity` must be an
    array-like table with no gaps, since `#affinity` will be used as the
    `cpumask_size` if it is greater than `uv.cpumask_size()`.

    If `get_old_affinity` is `true`, the previous affinity settings for the
    `thread` will be returned. Otherwise, `true` is returned after a
    successful call.

    Note: Thread affinity setting is not atomic on Windows. Unsupported on
    macOS.

    Parameters: ~
      • {thread}            (`uv.luv_thread_t`)
      • {affinity}          (`table<integer, boolean>`)
      • {get_old_affinity}  (`boolean?`)

    Return (multiple): ~
        (`table<integer, boolean>|boolean?`) affinity_or_success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_setname({name})                                *uv.thread_setname()*
    Sets the name of the current thread. Different platforms define different
    limits on the max number of characters a thread name can be: Linux, IBM i
    (16), macOS (64), Windows (32767), and NetBSD (32), etc. The name will be
    truncated if `name` is larger than the limit of the platform.

    Parameters: ~
      • {name}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.thread_setpriority({thread}, {priority})          *uv.thread_setpriority()*
    Sets the specified thread's scheduling priority setting. It requires
    elevated privilege to set specific priorities on some platforms.

    The priority can be set to the following constants.
    • uv.constants.THREAD_PRIORITY_HIGHEST
    • uv.constants.THREAD_PRIORITY_ABOVE_NORMAL
    • uv.constants.THREAD_PRIORITY_NORMAL
    • uv.constants.THREAD_PRIORITY_BELOW_NORMAL
    • uv.constants.THREAD_PRIORITY_LOWEST

    Parameters: ~
      • {thread}    (`uv.luv_thread_t`)
      • {priority}  (`integer`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
Miscellaneous utilities                          *luv-miscellaneous-utilities*

uv.cpu_info.cpu_info                                    *uv.cpu_info.cpu_info*

    Fields: ~
      • {model}  (`string`)
      • {speed}  (`integer`)
      • {times}  (`uv.cpu_info.cpu_info.times`)

uv.cpu_info.cpu_info.times                        *uv.cpu_info.cpu_info.times*

    Fields: ~
      • {idle}  (`integer`)
      • {irq}   (`integer`)
      • {nice}  (`integer`)
      • {sys}   (`integer`)
      • {user}  (`integer`)

uv.getrusage.result                                      *uv.getrusage.result*

    Fields: ~
      • {idrss}     (`integer`) (integral unshared data size)
      • {inblock}   (`integer`) (block input operations)
      • {isrss}     (`integer`) (integral unshared stack size)
      • {ixrss}     (`integer`) (integral shared memory size)
      • {majflt}    (`integer`) (page faults (hard page faults))
      • {maxrss}    (`integer`) (maximum resident set size)
      • {minflt}    (`integer`) (page reclaims (soft page faults))
      • {msgrcv}    (`integer`) (IPC messages received)
      • {msgsnd}    (`integer`) (IPC messages sent)
      • {nivcsw}    (`integer`) (involuntary context switches)
      • {nsignals}  (`integer`) (signals received)
      • {nswap}     (`integer`) (swaps)
      • {nvcsw}     (`integer`) (voluntary context switches)
      • {oublock}   (`integer`) (block output operations)
      • {stime}     (`uv.getrusage.result.time`) (system CPU time used)
      • {utime}     (`uv.getrusage.result.time`) (user CPU time used)

uv.getrusage.result.time                            *uv.getrusage.result.time*

    Fields: ~
      • {sec}   (`integer`)
      • {usec}  (`integer`)

uv.interface_addresses.addresses            *uv.interface_addresses.addresses*

    Fields: ~
      • {family}    (`string`)
      • {internal}  (`boolean`)
      • {ip}        (`string`)
      • {mac}       (`string`)
      • {netmask}   (`string`)

uv.os_get_passwd.passwd                              *uv.os_get_passwd.passwd*

    Fields: ~
      • {gid}       (`integer?`) (nil on Windows)
      • {homedir}   (`string`)
      • {shell}     (`string?`) (nil on Windows)
      • {uid}       (`integer?`) (nil on Windows)
      • {username}  (`string`)

uv.os_uname.info                                            *uv.os_uname.info*

    Fields: ~
      • {machine}  (`string`)
      • {release}  (`string`)
      • {sysname}  (`string`)
      • {version}  (`string`)


uv.available_parallelism()                        *uv.available_parallelism()*
    Returns an estimate of the default amount of parallelism a program should
    use. Always returns a non-zero value.

    On Linux, inspects the calling thread’s CPU affinity mask to determine
    if it has been pinned to specific CPUs.

    On Windows, the available parallelism may be underreported on systems with
    more than 64 logical CPUs.

    On other platforms, reports the number of CPUs that the operating system
    considers to be online.

    Return: ~
        (`integer`)

uv.chdir({cwd})                                                   *uv.chdir()*
    Sets the current working directory with the string `cwd`.

    Parameters: ~
      • {cwd}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.clock_gettime({clock_id})                              *uv.clock_gettime()*
    Obtain the current system time from a high-resolution real-time or
    monotonic clock source. `clock_id` can be the string `"monotonic"` or
    `"realtime"`.

    The real-time clock counts from the UNIX epoch (1970-01-01) and is subject
    to time adjustments; it can jump back in time.

    The monotonic clock counts from an arbitrary point in the past and never
    jumps back in time.

    Parameters: ~
      • {clock_id}  (`string`)

    Return (multiple): ~
        (`{ sec: integer, nsec: integer }?`) time
        (`string?`) err
        (`uv.error_name?`) err_name

uv.cpu_info()                                                  *uv.cpu_info()*
    Returns information about the CPU(s) on the system as a table of tables
    for each CPU found.

    Return (multiple): ~
        (`table<integer, uv.cpu_info.cpu_info>?`) cpu_info
        (`string?`) err
        (`uv.error_name?`) err_name

uv.cpumask_size()                                          *uv.cpumask_size()*
    Returns the maximum size of the mask used for process/thread affinities,
    or `ENOTSUP` if affinities are not supported on the current platform.

    Return (multiple): ~
        (`integer?`) size
        (`string?`) err
        (`uv.error_name?`) err_name

uv.cwd()                                                            *uv.cwd()*
    Returns the current working directory.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.exepath()                                                    *uv.exepath()*
    Returns the executable path.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.get_available_memory()                          *uv.get_available_memory()*
    Gets the amount of free memory that is still available to the process (in
    bytes). This differs from `uv.get_free_memory()` in that it takes into
    account any limits imposed by the OS. If there is no such constraint, or
    the constraint is unknown, the amount returned will be identical to
    `uv.get_free_memory()`.

    Return: ~
        (`number`)

uv.get_constrained_memory()                      *uv.get_constrained_memory()*
    Gets the amount of memory available to the process in bytes based on
    limits imposed by the OS. If there is no such constraint, or the
    constraint is unknown, 0 is returned. Note that it is not unusual for this
    value to be less than or greater than the total system memory.

    Return: ~
        (`number`)

uv.get_free_memory()                                    *uv.get_free_memory()*
    Returns the current free system memory in bytes.

    Return: ~
        (`number`)

uv.get_process_title()                                *uv.get_process_title()*
    Returns the title of the current process.

    Return (multiple): ~
        (`string?`) title
        (`string?`) err
        (`uv.error_name?`) err_name

uv.get_total_memory()                                  *uv.get_total_memory()*
    Returns the current total system memory in bytes.

    Return: ~
        (`number`)

uv.getgid()                                                      *uv.getgid()*
    Returns the group ID of the process. Note: This is not a libuv function
    and is not supported on Windows.

    Return: ~
        (`integer`)

uv.getrusage()                                                *uv.getrusage()*
    Returns the resource usage.

    Return (multiple): ~
        (`uv.getrusage.result?`) rusage
        (`string?`) err
        (`uv.error_name?`) err_name

uv.getrusage_thread()                                  *uv.getrusage_thread()*
    Gets the resource usage measures for the calling thread.

    Note Not supported on all platforms. May return `ENOTSUP`. On macOS and
    Windows not all fields are set (the unsupported fields are filled with
    zeroes).

    Return (multiple): ~
        (`uv.getrusage.result?`) rusage
        (`string?`) err
        (`uv.error_name?`) err_name

uv.gettimeofday()                                          *uv.gettimeofday()*
    Cross-platform implementation of `gettimeofday(2)`. Returns the seconds
    and microseconds of a unix time as a pair.

    Return (multiple): ~
        (`integer?`) seconds
        (`integer|string`) microseconds_or_err
        (`uv.error_name?`) err_name

uv.getuid()                                                      *uv.getuid()*
    Returns the user ID of the process. Note: This is not a libuv function and
    is not supported on Windows.

    Return: ~
        (`integer`)

uv.guess_handle({fd})                                      *uv.guess_handle()*
    Used to detect what type of stream should be used with a given file
    descriptor `fd`. Usually this will be used during initialization to guess
    the type of the stdio streams.

    Parameters: ~
      • {fd}  (`integer`)

    Return: ~
        (`string`)

uv.hrtime()                                                      *uv.hrtime()*
    Returns a current high-resolution time in nanoseconds as a number. This is
    relative to an arbitrary time in the past. It is not related to the time
    of day and therefore not subject to clock drift. The primary use is for
    measuring time between intervals.

    Return: ~
        (`integer`)

uv.if_indextoiid({ifindex})                               *uv.if_indextoiid()*
    Retrieves a network interface identifier suitable for use in an IPv6
    scoped address. On Windows, returns the numeric `ifindex` as a string. On
    all other platforms, `uv.if_indextoname()` is used.

    Parameters: ~
      • {ifindex}  (`integer`)

    Return (multiple): ~
        (`string?`) iid
        (`string?`) err
        (`uv.error_name?`) err_name

uv.if_indextoname({ifindex})                             *uv.if_indextoname()*
    IPv6-capable implementation of `if_indextoname(3)`.

    Parameters: ~
      • {ifindex}  (`integer`)

    Return (multiple): ~
        (`string?`) name
        (`string?`) err
        (`uv.error_name?`) err_name

uv.interface_addresses()                            *uv.interface_addresses()*
    Returns address information about the network interfaces on the system in
    a table. Each table key is the name of the interface while each associated
    value is an array of address information where fields are `ip`, `family`,
    `netmask`, `internal`, and `mac`.

    See |luv-constants| for supported address `family` output values.

    Return (multiple): ~
        (`table<string, table<integer, uv.interface_addresses.addresses>>?`)
        addresses
        (`string?`) err
        (`uv.error_name?`) err_name

uv.loadavg()                                                    *uv.loadavg()*
    Returns the load average as a triad. Not supported on Windows.

    Return (multiple): ~
        (`number`)
        (`number`)
        (`number`)

uv.os_environ()                                              *uv.os_environ()*
    Returns all environmental variables as a dynamic table of names associated
    with their corresponding values. Warning: This function is not
    thread-safe.

    Return (multiple): ~
        (`table<string, string>?`) env
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_get_passwd()                                        *uv.os_get_passwd()*
    Gets a subset of the password file entry for the current effective uid
    (not the real uid). On Windows, `uid`, `gid`, and `shell` are set to
    `nil`.

    Return (multiple): ~
        (`uv.os_get_passwd.passwd?`) passwd
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_getenv({name}, {size})                                  *uv.os_getenv()*
    Returns the environment variable specified by `name` as string. The
    internal buffer size can be set by defining `size`. If omitted,
    `LUAL_BUFFERSIZE` is used. If the environment variable exceeds the storage
    available in the internal buffer, `ENOBUFS` is returned. If no matching
    environment variable exists, `ENOENT` is returned. Warning: This function
    is not thread-safe.

    Parameters: ~
      • {name}  (`string`)
      • {size}  (`integer?`)

    Return (multiple): ~
        (`string?`) value
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_gethostname()                                      *uv.os_gethostname()*
    Returns the hostname.

    Return (multiple): ~
        (`string?`) hostname
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_getpid()                                                *uv.os_getpid()*
    Returns the current process ID.

    Return: ~
        (`number`)

uv.os_getppid()                                              *uv.os_getppid()*
    Returns the parent process ID.

    Return: ~
        (`number`)

uv.os_getpriority({pid})                                 *uv.os_getpriority()*
    Returns the scheduling priority of the process specified by `pid`.

    Parameters: ~
      • {pid}  (`integer`)

    Return (multiple): ~
        (`integer?`) priority
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_homedir()                                              *uv.os_homedir()*
    Returns the home directory. Warning: This function is not thread-safe.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_setenv({name}, {value})                                 *uv.os_setenv()*
    Sets the environmental variable specified by `name` with the string
    `value`. Warning: This function is not thread-safe.

    Parameters: ~
      • {name}   (`string`)
      • {value}  (`string`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_setpriority({pid}, {priority})                     *uv.os_setpriority()*
    Sets the scheduling priority of the process specified by `pid`. The
    `priority` range is between -20 (high priority) and 19 (low priority).

    Parameters: ~
      • {pid}       (`integer`)
      • {priority}  (`integer`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_tmpdir()                                                *uv.os_tmpdir()*
    Returns a temporary directory. Warning: This function is not thread-safe.

    Return (multiple): ~
        (`string?`) path
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_uname()                                                  *uv.os_uname()*
    Returns system information.

    Return (multiple): ~
        (`uv.os_uname.info?`) info
        (`string?`) err
        (`uv.error_name?`) err_name

uv.os_unsetenv({name})                                      *uv.os_unsetenv()*
    Unsets the environmental variable specified by `name`. Warning: This
    function is not thread-safe.

    Parameters: ~
      • {name}  (`string`)

    Return (multiple): ~
        (`boolean?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.print_active_handles()                          *uv.print_active_handles()*
    The same as `uv.print_all_handles()` except only active handles are
    printed. Note: This is not available on Windows. Warning: This function is
    meant for ad hoc debugging, there are no API/ABI stability guarantees.

uv.print_all_handles()                                *uv.print_all_handles()*
    Prints all handles associated with the main loop to stderr. The format is
    `[flags] handle-type handle-address`. Flags are `R` for referenced, `A`
    for active and `I` for internal. Note: This is not available on Windows.
    Warning: This function is meant for ad hoc debugging, there are no API/ABI
    stability guarantees.

uv.random({len}, {flags}, {callback})                            *uv.random()*
    Fills a string of length `len` with cryptographically strong random bytes
    acquired from the system CSPRNG. `flags` is reserved for future extension
    and must currently be `nil` or `0` or `{}`.

    Short reads are not possible. When less than `len` random bytes are
    available, a non-zero error value is returned or passed to the callback.
    If the callback is omitted, this function is completed synchronously.

    The synchronous version may block indefinitely when not enough entropy is
    available. The asynchronous version may not ever finish when the system is
    low on entropy.

    Parameters: ~
      • {len}       (`integer`)
      • {flags}     (`0`)
      • {callback}  (`nil?`) (async if provided, sync if `nil`)

    Overloads: ~
      • `fun`

    Return (multiple): ~
        (`string?`) bytes
        (`string?`) err
        (`uv.error_name?`) err_name

uv.resident_set_memory()                            *uv.resident_set_memory()*
    Returns the resident set size (RSS) for the current process.

    Return (multiple): ~
        (`integer?`) rss
        (`string?`) err
        (`uv.error_name?`) err_name

uv.set_process_title({title})                         *uv.set_process_title()*
    Sets the title of the current process with the string `title`.

    Parameters: ~
      • {title}  (`string`)

    Return (multiple): ~
        (`0?`) success
        (`string?`) err
        (`uv.error_name?`) err_name

uv.setgid({id})                                                  *uv.setgid()*
    Sets the group ID of the process with the integer `id`. Note: This is not
    a libuv function and is not supported on Windows.

    Parameters: ~
      • {id}  (`integer`)

uv.setuid({id})                                                  *uv.setuid()*
    Sets the user ID of the process with the integer `id`. Note: This is not a
    libuv function and is not supported on Windows.

    Parameters: ~
      • {id}  (`integer`)

uv.translate_sys_error({errcode})                   *uv.translate_sys_error()*
    Returns the libuv error message and error name (both in string form, see
    |luv-error-handling|) equivalent to the given platform dependent error
    code: POSIX error codes on Unix (the ones stored in errno), and Win32
    error codes on Windows (those returned by GetLastError() or
    WSAGetLastError()).

    Parameters: ~
      • {errcode}  (`integer`)

    Return (multiple): ~
        (`string?`) message
        (`string?`) name

uv.uptime()                                                      *uv.uptime()*
    Returns the current system uptime in seconds.

    Return (multiple): ~
        (`number?`) uptime
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
Metrics operations                                    *luv-metrics-operations*

uv.metrics_info.info                                    *uv.metrics_info.info*

    Fields: ~
      • {events}          (`integer`)
      • {events_waiting}  (`integer`)
      • {loop_count}      (`integer`)


uv.metrics_idle_time()                                *uv.metrics_idle_time()*
    Retrieve the amount of time the event loop has been idle in the kernel’s
    event provider (e.g. `epoll_wait`). The call is thread safe.

    The return value is the accumulated time spent idle in the kernel’s
    event provider starting from when the |uv_loop_t| was configured to
    collect the idle time.

    Note: The event loop will not begin accumulating the event provider’s
    idle time until calling `loop_configure` with `"metrics_idle_time"`.

    Return: ~
        (`number`)

uv.metrics_info()                                          *uv.metrics_info()*
    Get the metrics table from current set of event loop metrics. It is
    recommended to retrieve these metrics in a `prepare` callback (see
    `uv.new_prepare`, `uv.prepare_start`) in order to make sure there are no
    inconsistencies with the metrics counters.

    Return (multiple): ~
        (`uv.metrics_info.info?`) info
        (`string?`) err
        (`uv.error_name?`) err_name


==============================================================================
String manipulation functions              *luv-string-manipulation-functions*

These string utilities are needed internally for dealing with Windows, and are
exported to allow clients to work uniformly with this data when the libuv API
is not complete.

Notes:
1. New in luv version 1.49.0.
2. See the WTF-8 spec (https://simonsapin.github.io/wtf-8/) for information
   about WTF-8.
3. Luv uses Lua-style strings, which means that all inputs and return values
   (UTF-8 or UTF-16 strings) do not include a NUL terminator.

------------------------------------------------------------------------------








uv.address                                                        *uv.address*

    Fields: ~
      • {addr}       (`string`)
      • {canonname}  (`string?`)
      • {family}     (`string`)
      • {port}       (`integer?`)
      • {protocol}   (`string`)
      • {socktype}   (`string`)

uv.socketinfo                                                  *uv.socketinfo*

    Fields: ~
      • {family}  (`string`)
      • {ip}      (`string`)
      • {port}    (`integer`)

uv.uv_connect_t                               *uv.uv_connect_t* *uv_connect_t*
    Extends: |uv.uv_req_t|


uv.uv_fs_t                                              *uv.uv_fs_t* *uv_fs_t*
    Extends: |uv.uv_req_t|


uv.uv_getaddrinfo_t                   *uv.uv_getaddrinfo_t* *uv_getaddrinfo_t*
    Extends: |uv.uv_req_t|


uv.uv_getnameinfo_t                   *uv.uv_getnameinfo_t* *uv_getnameinfo_t*
    Extends: |uv.uv_req_t|


uv.uv_shutdown_t                            *uv.uv_shutdown_t* *uv_shutdown_t*
    Extends: |uv.uv_req_t|


uv.uv_udp_send_t                            *uv.uv_udp_send_t* *uv_udp_send_t*
    Extends: |uv.uv_req_t|


uv.uv_work_t                                        *uv.uv_work_t* *uv_work_t*
    Extends: |uv.uv_req_t|


uv.utf16_length_as_wtf8({utf16})                   *uv.utf16_length_as_wtf8()*
    Get the length (in bytes) of a UTF-16 (or UCS-2) string `utf16` value
    after converting it to WTF-8.

    Parameters: ~
      • {utf16}  (`string`)

    Return: ~
        (`integer`)

uv.utf16_to_wtf8({utf16})                                 *uv.utf16_to_wtf8()*
    Convert UTF-16 (or UCS-2) string `utf16` to WTF-8 string. The endianness
    of the UTF-16 (or UCS-2) string is assumed to be the same as the native
    endianness of the platform.

    Parameters: ~
      • {utf16}  (`string`)

    Return (multiple): ~
        (`string?`) wtf8
        (`string?`) err
        (`uv.error_name?`) err_name

uv.wtf8_length_as_utf16({wtf8})                    *uv.wtf8_length_as_utf16()*
    Get the length (in UTF-16 code units) of a WTF-8 `wtf8` value after
    converting it to UTF-16 (or UCS-2). Note: The number of bytes needed for a
    UTF-16 (or UCS-2) string is `<number of code units> * 2`.

    Parameters: ~
      • {wtf8}  (`string`)

    Return: ~
        (`integer`)

uv.wtf8_to_utf16({wtf8})                                  *uv.wtf8_to_utf16()*
    Convert WTF-8 string in `wtf8` to UTF-16 (or UCS-2) string. The endianness
    of the UTF-16 (or UCS-2) string will be the same as the native endianness
    of the platform.

    Parameters: ~
      • {wtf8}  (`string`)

    Return: ~
        (`string`)


 vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
