{"id":15047352,"url":"https://github.com/levalup/libuvcxx","last_synced_at":"2025-08-12T13:08:27.678Z","repository":{"id":242520649,"uuid":"808046238","full_name":"levalup/libuvcxx","owner":"levalup","description":"Single header C++ wrapper for libuv","archived":false,"fork":false,"pushed_at":"2024-07-26T13:31:25.000Z","size":368,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T01:44:38.663Z","etag":null,"topics":["cpp11","cpp14","cpp17","libuv","libuv-bindings"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levalup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-30T09:19:55.000Z","updated_at":"2024-07-26T13:30:28.000Z","dependencies_parsed_at":"2024-06-26T16:47:56.197Z","dependency_job_id":"4394513d-4211-4398-ba42-5d991c7799ae","html_url":"https://github.com/levalup/libuvcxx","commit_stats":null,"previous_names":["levalup/libuvcxx"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/levalup/libuvcxx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levalup%2Flibuvcxx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levalup%2Flibuvcxx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levalup%2Flibuvcxx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levalup%2Flibuvcxx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levalup","download_url":"https://codeload.github.com/levalup/libuvcxx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levalup%2Flibuvcxx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270065443,"owners_count":24520946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp11","cpp14","cpp17","libuv","libuv-bindings"],"created_at":"2024-09-24T20:57:03.707Z","updated_at":"2025-08-12T13:08:27.653Z","avatar_url":"https://github.com/levalup.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libuvcxx\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](\n    LICENSE)\n[![libuv](https://img.shields.io/badge/libuv-v1.48.0-green?logo=libuv\u0026logoColor=green)](\n    https://github.com/libuv/libuv)\n[![CMake](https://img.shields.io/badge/CMake-v3.9-%23064F8C?logo=cmake\u0026logoColor=%23064F8C)](\n    https://cmake.org)\n[![C++](https://img.shields.io/badge/C++-11-%23512BD4.svg?logo=C%2B%2B\u0026logoColor=%23512BD4)](\n    https://en.cppreference.com/w/cpp/11)\n[![C++](https://img.shields.io/badge/C++-14-%23512BD4.svg?logo=C%2B%2B\u0026logoColor=%23512BD4)](\n    https://en.cppreference.com/w/cpp/14)\n[![C++](https://img.shields.io/badge/C++-17-%23512BD4.svg?logo=C%2B%2B\u0026logoColor=%23512BD4)](\n    https://en.cppreference.com/w/cpp/17)\n\n[![Build](https://github.com/levalup/libuvcxx/actions/workflows/build.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build.yml)\n[![Build Classic](https://github.com/levalup/libuvcxx/actions/workflows/build-classic.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-classic.yml)\n[![Build Multi-GCC](https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml)\n[![Build GCC-std](https://github.com/levalup/libuvcxx/actions/workflows/build-gcc-std.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-gcc-std.yml)\n[![Build MacOS](https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml)\n[![Build MinGW](https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml)\n[![Build MSVC-std](https://github.com/levalup/libuvcxx/actions/workflows/build-msvc-std.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/build-msvc-std.yml)\n\n[![Single Header](https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml)\n[![Release](https://github.com/levalup/libuvcxx/actions/workflows/release.yml/badge.svg)](\n    https://github.com/levalup/libuvcxx/actions/workflows/release.yml)\n\n\u003e C++ wrapper for libuv, header only.\n\n## 1. Usage\n\nCopy `include` into your project.  \nOf course, you also need to configure `libuv` properly.  \nEnjoy using it.  \n\n`libuvcxx` supports single header file usage.\nYou can find `uvcxx-single.h` in the [release packages](https://github.com/levalup/libuvcxx/releases).\n\n```cpp\n#include \u003cuvcxx.h\u003e\n\nvoid detach_work() {\n    // uv::timer_t()      // Create handle\n    // .start(1000, 1000) // Start timer\n    // .detach()          // Detached handle won't be implicitly closed\n    // .call(...)         // Set callback function\n    uv::timer_t().start(100, 1).detach().call([]() {\n        std::cout \u003c\u003c \"Hello,\";\n        // Tell the associated handle to close\n        throw uvcxx::close_handle();\n    });\n\n    // Classic implementation\n    uv::timer_t timer;\n    timer.start(200, 1).call([=]() mutable {\n        std::cout \u003c\u003c \" World!\" \u003c\u003c std::endl;\n        timer.close();  // Capture timer in callback function is safe ^_^.\n    });\n    timer.detach();\n    // If detach is not called, the temporary timer will be automatically closed.\n}\n\nint main() {\n    detach_work();\n    return uv::default_loop().run();\n}\n```\n\nThe `data` field for context has already been occupied.\nPlease note that this field should not be used anymore.\n\nNo explicit `close` operation is required, except when the `handle` is `running`.\nThe `handle` can continue to work without any external references, so that explicit `close' is needed at this time.\n\nSee [lifecycle.md](docs/lifecycle.md) for more details.\n\nRemember, it is always a good practice to explicitly call `close` at any time,\nunless you are very clear about the lifecycle of the handle.\n\n## 2. Compatibility\n\n`libuvcxx` requires at least `C++11` and is also compatible with the new features in `C++14` and `C++17`.\n\n\u003e Tested and passed in gcc `4.8.5` with `libuv` `v1.44.2` on `CentOS7`.\n\n`libuvcxx` can be compatible with libuv: `\u003e= 1.0.0, \u003c= 1.48.0`.\nProvided by [test_libuv.sh](scripts/test_libuv.sh).\n\n\u003e Notice: As the development proceeds, compatibility may change with new features.\n\n`libuvcxx` covers `[100%]` all `306` APIs described in the [libuv doc](https://docs.libuv.org/en/v1.x/).\nProvided by [libuv_api_coverage.py](scripts/libuv_api_coverage.py).\n\nSee [coverage.md](docs/coverage.md) for more details.\n\n## 3. Schedule\n\nMore examples and documentation are pending to be added.  \nAs well as higher-level encapsulations for some common usage scenarios.\n\n## 4. Exception\n\n`libuvcxx` uses exception to handle exceptions.\n\nMost interfaces that don't often encounter errors will throw an `uvcxx::errcode` exception upon failure.\nThis type of exception is thrown to facilitate the flexible use of interfaces in `promise` or `callback` contexts.\n\nCertain interfaces that frequently encounter errors will not throw exceptions.\nIn such cases, the success of the interface call should be judged by the return value, for example, `uv::spawn`.\n\nIf you're not sure whether an interface will throw an exception, please directly refer to the implementation code of the corresponding interface.\nAfter all, we are an open-source, header-only library.\n\nYou can use the macro definition `UVCXX_NO_EXCEPTION` before `#include \u003cuvcxx.h\u003e` to prevent interfaces from throwing exceptions.\nHowever, in the current version, exceptions are still used to handle some transactions.\nFuture versions may consider finding suitable ways to completely eliminate the use of exceptions.\n\n## 5. Adjusted API\n\nMost APIs have been changed from `uv_xxx` to `uv::xxx`, \nand are placed in the necessary C++ classes according to their types.\n\nSuch as\n- `uv_handle_t` -\u003e `uv::handle_t`\n- `uv_fs_open` -\u003e `uv::fs::open`\n- `uv_default_loop` -\u003e `uv::default_loop`\n- `uv_close` -\u003e `uv::handle_t::close`\n.\n\nHowever, some APIs still cannot be fully migrated to C++ with consistent naming,\nso the following lists the interface names with obvious differences (this may not cover all cases).\n\n- `uv_fs_get_type` -\u003e `uv::fs_t::fs_type`\n- `uv_read_start` -\u003e `uv::stream_t::alloc` + `uv::stream_t::read_start`\n- `uv_os_environ` -\u003e `uv::os::get_environ`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevalup%2Flibuvcxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevalup%2Flibuvcxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevalup%2Flibuvcxx/lists"}