{"id":13418018,"url":"https://github.com/nodejs/node-addon-examples","last_synced_at":"2025-04-10T02:17:05.764Z","repository":{"id":6527058,"uuid":"7768093","full_name":"nodejs/node-addon-examples","owner":"nodejs","description":"Node.js C++ addon examples from http://nodejs.org/docs/latest/api/addons.html","archived":false,"fork":false,"pushed_at":"2025-04-07T04:33:11.000Z","size":5135,"stargazers_count":2535,"open_issues_count":59,"forks_count":600,"subscribers_count":80,"default_branch":"main","last_synced_at":"2025-04-10T02:16:56.901Z","etag":null,"topics":["node","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2013-01-23T05:05:51.000Z","updated_at":"2025-04-06T01:23:06.000Z","dependencies_parsed_at":"2023-02-18T02:15:46.616Z","dependency_job_id":"822c96d2-91c9-4c31-8649-d5157a9e93df","html_url":"https://github.com/nodejs/node-addon-examples","commit_stats":{"total_commits":171,"total_committers":44,"mean_commits":"3.8863636363636362","dds":0.8421052631578947,"last_synced_commit":"8c1e1984fd5934a6c629b21cba9f9094d7f5c511"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fnode-addon-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fnode-addon-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fnode-addon-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fnode-addon-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodejs","download_url":"https://codeload.github.com/nodejs/node-addon-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142907,"owners_count":21054672,"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":["node","nodejs"],"created_at":"2024-07-30T22:00:57.188Z","updated_at":"2025-04-10T02:17:05.731Z","avatar_url":"https://github.com/nodejs.png","language":"C++","readme":"Node.js Addon Examples\n=========================================\n\n**A repository of [Node.js Addons](https://nodejs.org/api/addons.html#addons_c_addons) examples.**\n\nImplementations of examples are named either after Node.js versions (`node_0.10`,\n`node_0.12`, etc), or Node.js addon implementation APIs:\n\n- [`nan`](https://github.com/nodejs/nan): C++-based abstraction between Node and direct V8 APIs.\n- [`Node-API`](https://nodejs.org/api/n-api.html): C-based API guaranteeing [ABI stability](https://nodejs.org/en/docs/guides/abi-stability/) across different node versions as well as JavaScript engines. (Node-API was previously known as N-API.)\n- [`node-addon-api`](https://github.com/nodejs/node-addon-api): header-only C++ wrapper classes which simplify the use of the C-based Node-API.\n- [`node-addon-api-addon-class`](https://github.com/nodejs/node-addon-api/tree/main/doc/addon.md): Similar to `node-addon-api`, but deriving from the `Napi::Addon` class. [1_hello_world](./src/1-getting-started/1_hello_world) provides an example.\n\nImplementations against unsupported versions of Node.js are provided for\ncompleteness and historical context. They are not maintained.\n\nThe examples are primarily maintained for Node-API and node-addon-api and as outlined in\nthe Node.js [documentation](https://nodejs.org/dist/latest/docs/api/addons.html),\nunless there is a need for direct access to functionality which\nis not exposed by Node-API, use Node-API.\n\nThe [Node-API Resource](http://nodejs.github.io/node-addon-examples/) offers an\nexcellent orientation and tips for developers just getting started with Node-API\nand `node-addon-api`.\n\n## Usage\n\nThe directory structure is as follows:\n\n```sh\nREPO_ROOT\n├── test_all.js\n├── package.json\n├── README.md\n└── src\n    ├── 1-getting-started\n    │   ├── example1\n    │   │   ├── nan\n    │   │   ├── node-addon-api\n    │   │   └── napi\n    │   ├── example2\n    │   └── example3\n    ├── 2-js-to-native-conversion\n    ├── 3-context-awareness\n    ├── 4-references-and-handle-scope\n    ├── 5-async-work\n    ├── 6-threadsafe-function\n    ├── 7-events\n    └── 8-tooling\n```\n\nIn each example's implementation subdirectory, run\n\n```text\nnpm install\nnode ./\n```\n\nto see the example in action.\n","funding_links":[],"categories":["TODO scan for Android support in followings","C++","nodejs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejs%2Fnode-addon-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodejs%2Fnode-addon-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejs%2Fnode-addon-examples/lists"}