Name Date Size

..25-Oct-20244 KiB

addon.mdH A D25-Oct-20246.2 KiB

array.mdH A D25-Oct-20242.6 KiB

array_buffer.mdH A D25-Oct-20245.3 KiB

async_context.mdH A D25-Oct-20242.5 KiB

async_operations.mdH A D25-Oct-20241.3 KiB

async_worker.mdH A D25-Oct-202414.3 KiB

async_worker_variants.mdH A D25-Oct-202420.8 KiB

bigint.mdH A D25-Oct-20242.7 KiB

boolean.mdH A D25-Oct-20241.6 KiB

buffer.mdH A D25-Oct-20249 KiB

callback_scope.mdH A D25-Oct-20241.3 KiB

callbackinfo.mdH A D25-Oct-20242.5 KiB

checker-tool.mdH A D25-Oct-20241 KiB

class_property_descriptor.mdH A D25-Oct-20243.5 KiB

cmake-js.mdH A D25-Oct-20242.7 KiB

conversion-tool.mdH A D25-Oct-2024643

dataview.mdH A D25-Oct-20246.6 KiB

date.mdH A D25-Oct-20241.5 KiB

env.mdH A D25-Oct-20245.9 KiB

error.mdH A D25-Oct-20243.2 KiB

error_handling.mdH A D25-Oct-20249.8 KiB

escapable_handle_scope.mdH A D25-Oct-20242.5 KiB

external.mdH A D25-Oct-20242.8 KiB

external_buffer.mdH A D25-Oct-2024898

function.mdH A D25-Oct-202412.7 KiB

function_reference.mdH A D25-Oct-20247.9 KiB

generator.mdH A D25-Oct-2024542

handle_scope.mdH A D25-Oct-20242.2 KiB

hierarchy.mdH A D25-Oct-20243.9 KiB

instance_wrap.mdH A D25-Oct-202414.8 KiB

maybe.mdH A D25-Oct-20241.8 KiB

memory_management.mdH A D25-Oct-20241.1 KiB

name.mdH A D25-Oct-2024657

node-gyp.mdH A D25-Oct-20242.7 KiB

number.mdH A D25-Oct-20243.6 KiB

object.mdH A D25-Oct-202410.8 KiB

object_lifetime_management.mdH A D25-Oct-20243.8 KiB

object_reference.mdH A D25-Oct-20243.3 KiB

object_wrap.mdH A D25-Oct-202422 KiB

prebuild_tools.mdH A D25-Oct-2024809

promises.mdH A D25-Oct-20242.1 KiB

property_descriptor.mdH A D25-Oct-20249.5 KiB

propertylvalue.mdH A D25-Oct-20241.2 KiB

range_error.mdH A D25-Oct-20241.6 KiB

README.mdH A D25-Oct-20245.7 KiB

reference.mdH A D25-Oct-20243.1 KiB

setup.mdH A D25-Oct-20242.9 KiB

string.mdH A D25-Oct-20242.5 KiB

symbol.mdH A D25-Oct-20242.2 KiB

syntax_error.mdH A D25-Oct-20241.7 KiB

threadsafe.mdH A D25-Oct-20246.8 KiB

threadsafe_function.mdH A D25-Oct-20249.9 KiB

type_error.mdH A D25-Oct-20241.6 KiB

type_taggable.mdH A D25-Oct-20241.4 KiB

typed_array.mdH A D25-Oct-20241.4 KiB

typed_array_of.mdH A D25-Oct-20243.8 KiB

typed_threadsafe_function.mdH A D25-Oct-202410.6 KiB

value.mdH A D25-Oct-20248 KiB

version_management.mdH A D25-Oct-20241.1 KiB

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