• Home
Name Date Size #Lines LOC

..--

README.mdD06-May-20255.7 KiB142117

addon.mdD06-May-20256.2 KiB164127

array.mdD06-May-20252.6 KiB8260

array_buffer.mdD06-May-20255.3 KiB166116

async_context.mdD06-May-20252.5 KiB8760

async_operations.mdD06-May-20251.3 KiB3223

async_worker.mdD06-May-202514.3 KiB429309

async_worker_variants.mdD06-May-202520.8 KiB579426

bigint.mdD06-May-20252.7 KiB9866

boolean.mdD06-May-20251.6 KiB6942

buffer.mdD06-May-20259 KiB248180

callback_scope.mdD06-May-20251.3 KiB5535

callbackinfo.mdD06-May-20252.5 KiB9861

checker-tool.mdD06-May-20251 KiB3322

class_property_descriptor.mdD06-May-20253.5 KiB12493

cmake-js.mdD06-May-20252.7 KiB6942

conversion-tool.mdD06-May-2025643 2820

dataview.mdD06-May-20256.6 KiB249157

date.mdD06-May-20251.5 KiB6945

env.mdD06-May-20255.9 KiB208146

error.mdD06-May-20253.2 KiB12175

error_handling.mdD06-May-20259.8 KiB255192

escapable_handle_scope.mdD06-May-20252.5 KiB8155

external.mdD06-May-20252.8 KiB7149

external_buffer.mdD06-May-2025898 1915

function.mdD06-May-202512.7 KiB403278

function_reference.mdD06-May-20257.9 KiB239162

generator.mdD06-May-2025542 149

handle_scope.mdD06-May-20252.2 KiB7855

hierarchy.mdD06-May-20253.9 KiB9693

instance_wrap.mdD06-May-202514.8 KiB409325

maybe.mdD06-May-20251.8 KiB7754

memory_management.mdD06-May-20251.1 KiB2820

name.mdD06-May-2025657 3020

node-gyp.mdD06-May-20252.7 KiB8364

number.mdD06-May-20253.6 KiB164102

object.mdD06-May-202510.8 KiB412293

object_lifetime_management.mdD06-May-20253.8 KiB8470

object_reference.mdD06-May-20253.3 KiB11876

object_wrap.mdD06-May-202522 KiB589462

prebuild_tools.mdD06-May-2025809 1713

promises.mdD06-May-20252.1 KiB8050

property_descriptor.mdD06-May-20259.5 KiB287222

propertylvalue.mdD06-May-20251.2 KiB5135

range_error.mdD06-May-20251.6 KiB6037

reference.mdD06-May-20253.1 KiB11469

setup.mdD06-May-20252.9 KiB9369

string.mdD06-May-20252.5 KiB9467

symbol.mdD06-May-20252.2 KiB6145

syntax_error.mdD06-May-20251.7 KiB6744

threadsafe.mdD06-May-20256.8 KiB122102

threadsafe_function.mdD06-May-20259.9 KiB291230

type_error.mdD06-May-20251.6 KiB6037

type_taggable.mdD06-May-20251.4 KiB4129

typed_array.mdD06-May-20251.4 KiB7949

typed_array_of.mdD06-May-20253.8 KiB13894

typed_threadsafe_function.mdD06-May-202510.6 KiB307245

value.mdD06-May-20258 KiB356249

version_management.mdD06-May-20251.1 KiB4430

README.md

1# node-addon-api Documents
2
3* [Setup](#setup)
4* [API Documentation](#api)
5* [Examples](#examples)
6* [ABI Stability Guideline](#abi-stability-guideline)
7* [More resource and info about native Addons](#resources)
8
9Node-API is an ABI stable C interface provided by Node.js for building native
10addons. It is independent of the underlying JavaScript runtime (e.g.  or ChakraCore)
11and is maintained as part of Node.js itself. It is intended to insulate
12native addons from changes in the underlying JavaScript engine and allow
13modules compiled for one version to run on later versions of Node.js without
14recompilation.
15
16The `node-addon-api` module, which is not part of Node.js, preserves the benefits
17of the Node-API as it consists only of inline code that depends only on the stable API
18provided by Node-API. As such, modules built against one version of Node.js
19using node-addon-api should run without having to be rebuilt with newer versions
20of Node.js.
21
22## Setup
23  - [Installation and usage](setup.md)
24  - [node-gyp](node-gyp.md)
25  - [cmake-js](cmake-js.md)
26  - [Conversion tool](conversion-tool.md)
27  - [Checker tool](checker-tool.md)
28  - [Generator](generator.md)
29  - [Prebuild tools](prebuild_tools.md)
30
31<a name="api"></a>
32
33## API Documentation
34
35The following is the documentation for node-addon-api.
36
37 - [Full Class Hierarchy](hierarchy.md)
38 - [Addon Structure](addon.md)
39 - Data Types:
40    - [Env](env.md)
41    - [CallbackInfo](callbackinfo.md)
42    - [Reference](reference.md)
43    - [Value](value.md)
44        - [Name](name.md)
45            - [Symbol](symbol.md)
46            - [String](string.md)
47        - [Number](number.md)
48        - [Date](date.md)
49        - [BigInt](bigint.md)
50        - [Boolean](boolean.md)
51        - [External](external.md)
52        - [Object](object.md)
53            - [Array](array.md)
54            - [ObjectReference](object_reference.md)
55    - [PropertyDescriptor](property_descriptor.md)
56    - [Function](function.md)
57        - [FunctionReference](function_reference.md)
58    - [ObjectWrap](object_wrap.md)
59        - [ClassPropertyDescriptor](class_property_descriptor.md)
60    - [Buffer](buffer.md)
61    - [ArrayBuffer](array_buffer.md)
62    - [TypedArray](typed_array.md)
63      - [TypedArrayOf](typed_array_of.md)
64    - [DataView](dataview.md)
65 - [Error Handling](error_handling.md)
66    - [Error](error.md)
67      - [TypeError](type_error.md)
68      - [RangeError](range_error.md)
69      - [SyntaxError](syntax_error.md)
70 - [Object Lifetime Management](object_lifetime_management.md)
71    - [HandleScope](handle_scope.md)
72    - [EscapableHandleScope](escapable_handle_scope.md)
73 - [Memory Management](memory_management.md)
74 - [Async Operations](async_operations.md)
75    - [AsyncWorker](async_worker.md)
76    - [AsyncContext](async_context.md)
77    - [AsyncWorker Variants](async_worker_variants.md)
78 - [Thread-safe Functions](threadsafe.md)
79    - [ThreadSafeFunction](threadsafe_function.md)
80    - [TypedThreadSafeFunction](typed_threadsafe_function.md)
81 - [Promises](promises.md)
82 - [Version management](version_management.md)
83
84<a name="examples"></a>
85
86## Examples
87
88Are you new to **node-addon-api**? Take a look at our **[examples]()**
89
90- [Hello World](/tree/main/src/1-getting-started/1_hello_world)
91- [Pass arguments to a function](/tree/main/src/1-getting-started/2_function_arguments/node-addon-api)
92- [Callbacks](/tree/main/src/1-getting-started/3_callbacks/node-addon-api)
93- [Object factory](/tree/main/src/1-getting-started/4_object_factory/node-addon-api)
94- [Function factory](/tree/main/src/1-getting-started/5_function_factory/node-addon-api)
95- [Wrapping C++ Object](/tree/main/src/1-getting-started/6_object_wrap/node-addon-api)
96- [Factory of wrapped object](/tree/main/src/1-getting-started/7_factory_wrap/node-addon-api)
97- [Passing wrapped object around](/tree/main/src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api)
98
99<a name="abi-stability-guideline"></a>
100
101## ABI Stability Guideline
102
103It is important to remember that *other* Node.js interfaces such as
104`libuv` (included in a project via `#include <uv.h>`) are not ABI-stable across
105Node.js major versions. Thus, an addon must use Node-API and/or `node-addon-api`
106exclusively and build against a version of Node.js that includes an
107implementation of Node-API (meaning an active LTS version of Node.js) in
108order to benefit from ABI stability across Node.js major versions. Node.js
109provides an [ABI stability guide][] containing a detailed explanation of ABI
110stability in general, and the Node-API ABI stability guarantee in particular.
111
112<a name="resources"></a>
113
114## More resource and info about native Addons
115
116There are three options for implementing addons: Node-API, nan, or direct
117use of internal , libuv, and Node.js libraries. Unless there is a need for
118direct access to functionality that is not exposed by Node-API as outlined
119in [C/C++ addons](/dist/latest/docs/api/addons.html)
120in Node.js core, use Node-API. Refer to
121[C/C++ addons with Node-API](/dist/latest/docs/api/n-api.html)
122for more information on Node-API.
123
124- [C++ Addons](/dist/latest/docs/api/addons.html)
125- [Node-API](/dist/latest/docs/api/n-api.html)
126- [Node-API - Next Generation Node API for Native Modules]()
127- [How We Migrated Realm JavaScript From NAN to Node-API](/article/realm-javascript-nan-to-n-api)
128
129As node-addon-api's core mission is to expose the plain C Node-API as C++
130wrappers, tools that facilitate n-api/node-addon-api providing more
131convenient patterns for developing a Node.js add-on with n-api/node-addon-api
132can be published to NPM as standalone packages. It is also recommended to tag
133such packages with `node-addon-api` to provide more visibility to the community.
134
135Quick links to NPM searches: [keywords:node-addon-api](/search?q=keywords%3Anode-addon-api).
136
137<a name="other-bindings"></a>
138
139## Other bindings
140
141[ABI stability guide]: /en/docs/guides/abi-stability/
142