1
- # ** Node.js API (N-API) Package**
2
-
3
- This package contains ** header-only C++ wrapper classes** for the
4
- ** ABI-stable Node.js API** also known as ** N-API** , providing C++ object
5
- model and exception handling semantics with low overhead. It guarantees
6
- backward compatibility when used with older versions of Node.js that do
7
- not have N-API built-in.
8
-
9
- N-API is an API for building native addons. It is independent from the
10
- underlying JavaScript runtime (e.g. V8 or ChakraCore) and is maintained as
11
- part of Node.js itself. This API will be Application Binary Interface (ABI)
12
- stable across versions and flavors of Node.js. It is intended to insulate
1
+ # ** node-addon-api module**
2
+ This module contains ** header-only C++ wrapper classes** which simplify
3
+ the use of the C based [ N-API] ( https://nodejs.org/dist/latest/docs/api/n-api.html )
4
+ provided by Node.js when using C++. It provides a C++ object model
5
+ and exception handling semantics with low overhead.
6
+
7
+ N-API is an ABI stable C interface provided by Node.js for building native
8
+ addons. It is independent from the underlying JavaScript runtime (e.g. V8 or ChakraCore)
9
+ and is maintained as part of Node.js itself. It is intended to insulate
13
10
native addons from changes in the underlying JavaScript engine and allow
14
11
modules compiled for one version to run on later versions of Node.js without
15
- recompilation. N-API guarantees the ** API** and ** ABI** compatibility across
16
- different versions of Node.js. So if you switched to a different version of
17
- Node.js, you would not need to reinstall or recompile the native addon.
12
+ recompilation.
18
13
19
- APIs exposed by N-API are generally used to create and manipulate JavaScript
20
- values. Concepts and operations generally map to ideas specified in the
21
- ** ECMA262 Language Specification** .
14
+ The ` node-addon-api ` module, which is not part of Node.js, preserves the benefits
15
+ of the N-API as it consists only of inline code that depends only on the stable API
16
+ provided by N-API. As such, modules built against one version of Node.js
17
+ using node-addon-api should run without having to be rebuilt with newer versions
18
+ of Node.js.
19
+
20
+ As new APIs are added to N-API, node-addon-api must be updated to provide
21
+ wrappers for those new APIs. For this reason node-addon-api provides
22
+ methods that allow callers to obtain the underlying N-API handles so
23
+ direct calls to N-API and the use of the objects/methods provided by
24
+ node-addon-api can be used together. For example, in order to be able
25
+ to use an API for which the node-add-api does not yet provide a wrapper.
26
+
27
+ APIs exposed by node-addon-api are generally used to create and
28
+ manipulate JavaScript values. Concepts and operations generally map
29
+ to ideas specified in the ** ECMA262 Language Specification** .
22
30
23
31
- ** [ Setup] ( #setup ) **
24
32
- ** [ API Documentation] ( #api ) **
@@ -47,6 +55,10 @@ values. Concepts and operations generally map to ideas specified in the
47
55
<a name =" api " ></a >
48
56
49
57
### ** API Documentation**
58
+
59
+ The following is the documentation for node-addon-api (NOTE:
60
+ still a work in progress as its not yet complete).
61
+
50
62
- [ Basic Types] ( doc/basic_types.md )
51
63
- [ Array] ( doc/array.md )
52
64
- [ Symbol] ( doc/symbol.md )
@@ -86,7 +98,7 @@ values. Concepts and operations generally map to ideas specified in the
86
98
87
99
### ** Examples**
88
100
89
- Are you new to ** N-API ** ? Take a look at our ** [ examples] ( https://github.com/nodejs/abi-stable-node-addon-examples ) **
101
+ Are you new to ** node-addon-api ** ? Take a look at our ** [ examples] ( https://github.com/nodejs/abi-stable-node-addon-examples ) **
90
102
91
103
- ** [ Hello World] ( https://github.com/nodejs/abi-stable-node-addon-examples/tree/master/1_hello_world/node-addon-api ) **
92
104
- ** [ Pass arguments to a function] ( https://github.com/nodejs/abi-stable-node-addon-examples/tree/master/2_function_arguments/node-addon-api ) **
@@ -101,7 +113,7 @@ Are you new to **N-API**? Take a look at our **[examples](https://github.com/nod
101
113
102
114
### ** Tests**
103
115
104
- To run the ** N-API ** tests do:
116
+ To run the ** node-addon-api ** tests do:
105
117
106
118
```
107
119
npm install
0 commit comments