{"id":15296111,"url":"https://github.com/ajihyf/node-addon-api-helper","last_synced_at":"2025-04-13T19:40:25.410Z","repository":{"id":57687796,"uuid":"481192944","full_name":"ajihyf/node-addon-api-helper","owner":"ajihyf","description":"A more convenient, type-safe and boilerplate-less way to write Node.js C++ addons.","archived":false,"fork":false,"pushed_at":"2024-03-26T11:10:59.000Z","size":158,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-26T09:38:54.653Z","etag":null,"topics":["cpp","n-api","napi","node-addon-api"],"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/ajihyf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-04-13T11:43:12.000Z","updated_at":"2024-06-21T16:55:43.000Z","dependencies_parsed_at":"2024-09-30T18:09:27.863Z","dependency_job_id":"998645ac-b166-47f8-a068-0b32b9653c69","html_url":"https://github.com/ajihyf/node-addon-api-helper","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fnode-addon-api-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fnode-addon-api-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fnode-addon-api-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajihyf%2Fnode-addon-api-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajihyf","download_url":"https://codeload.github.com/ajihyf/node-addon-api-helper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248770093,"owners_count":21158908,"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","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":["cpp","n-api","napi","node-addon-api"],"created_at":"2024-09-30T18:09:25.696Z","updated_at":"2025-04-13T19:40:25.380Z","avatar_url":"https://github.com/ajihyf.png","language":"C++","readme":"# node-addon-api-helper\u003c!-- omit in toc --\u003e\n\n[![NPM](https://img.shields.io/npm/v/node-addon-api-helper)](https://www.npmjs.com/package/node-addon-api-helper)\n[![CI](https://github.com/ajihyf/node-addon-api-helper/workflows/ci/badge.svg)](https://github.com/ajihyf/node-addon-api-helper/actions/workflows/ci.yml)\n[![lint](https://github.com/ajihyf/node-addon-api-helper/workflows/lint/badge.svg)](https://github.com/ajihyf/node-addon-api-helper/actions/workflows/lint.yml)\n![C++17](https://img.shields.io/badge/C%2B%2B-17-blue.svg)\n[![LICENSE](https://img.shields.io/github/license/ajihyf/node-addon-api-helper)](https://github.com/ajihyf/node-addon-api-helper/blob/main/LICENSE)\n\n![Windows Support](https://img.shields.io/static/v1?label=Windows\u0026logo=windows\u0026logoColor=white\u0026message=support\u0026color=success)\n![Linux Support](https://img.shields.io/static/v1?label=Linux\u0026logo=linux\u0026logoColor=white\u0026message=support\u0026color=success)\n![Mac Support](https://img.shields.io/static/v1?label=macOS\u0026logo=apple\u0026logoColor=white\u0026message=support\u0026color=success)\n\nBased on [node-addon-api](https://github.com/nodejs/node-addon-api), **node-addon-api-helper(naah)** provides a more convenient, type-safe and boilerplate-less way to write Node.js C++ addons.\n\nFeatures:\n\n- Automatically transform values between JavaScript and C++\n- Automatically register exports\n- Class binding (with inheritance)\n- Custom object type\n- Thread safe function\n- Create async work and return promise\n- Can be used together with original node-addon-api, no need to rewrite all\n- Pure header, can be easily integrated\n\n## QuickStart\n\n```bash\nnpm install node-addon-api node-addon-api-helper\n```\n\nAdd following content to your GYP file.\n\n```gyp\n{\n  'include_dirs': [\n    \"\u003c!(node -p \\\"require('node-addon-api').include_dir\\\")\",\n    \"\u003c!(node -p \\\"require('node-addon-api-helper').include_dir\\\")\",\n  ]\n}\n```\n\n**naah** heavily depends on **C++17**, if you haven't configured your project on C++17, have a look at [naah.gypi](./naah.gypi) as an example.\n\nA hello world example :\n\n```cpp\n#include \u003cnaah.h\u003e\n\nuint32_t add(uint32_t a, uint32_t b) {\n  return a + b;\n}\n\nNAAH_REGISTRATION {\n  naah::Registration::Function\u003cadd\u003e(\"add\");\n}\n\nNAAH_EXPORT\n```\n\n## Documentation\n\n- [Exports](./doc/exports.md)\n- [Function](./doc/function.md)\n- [Object](./doc/object.md)\n- [Class](./doc/class.md)\n- [Mix with node-addon-api](./doc/mix_with_napi.md)\n- [Thread Safe Function](./doc/thread_safe_function.md)\n- [Async Work](./doc/async_work.md)\n- [Error Handling](./doc/error_handling.md)\n\n## Examples\n\nSee `naah` directories in the [fork of node-addon-examples](https://github.com/ajihyf/node-addon-examples) for examples.\n\n## Thanks\n\n- Based on [node-addon-api](https://github.com/nodejs/node-addon-api).\n- Inspired by [napi-rs](https://napi.rs), [emscripten](https://emscripten.org/) and [nbind](https://github.com/charto/nbind).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajihyf%2Fnode-addon-api-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajihyf%2Fnode-addon-api-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajihyf%2Fnode-addon-api-helper/lists"}