Skip to content

moonbit-community/uv.mbt

Repository files navigation

tonyfettes/uv

This is a MoonBit binding to the libuv library.

Quickstart

  1. Add this module as a dependency to your MoonBit project.

    moon update
    moon add tonyfettes/uv
  2. Import tonyfettes/uv package where you need it.

    {
      "import": [
        "tonyfettes/uv"
      ]
    }
  3. Use the tonyfettes/uv package in your MoonBit project.

    fn main {
      try {
        let uv = @uv.Loop::new()
        let options = @uv.ProcessOptions::new(
          "moon",
          ["moon", "version"],
          fn(process, exit_status, term_signal) {
            println(
              "Process exited with status \{exit_status} and signal \{term_signal}",
            )
            process.close(() => ())
          },
        )
        let process = uv.spawn(options)
        println("Launched process with ID \{(process).pid()}")
        uv.run(Default)
        uv.stop()
        uv.close()
      } catch {
        error => println("Error: \{error}")
      }
    }

Roadmap

The following libuv APIs are not yet implemented in this library:

Handle Functions

  • uv_ref() - Reference counting for handles
  • uv_unref() - Unreference handles
  • uv_has_ref() - Check handle reference status

Process Functions

  • uv_get_osfhandle() - Get OS handle from file descriptor
  • uv_open_osfhandle() - Open file descriptor from OS handle

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5