|
3 | 3 | - **[Introduction](#introduction)**
|
4 | 4 | - **[Contributing](CONTRIBUTING.md)**
|
5 | 5 | - **[Code of Conduct](CODE_OF_CONDUCT.md)**
|
| 6 | +- **[Install](#install)** |
| 7 | +- **[API](#api)** |
6 | 8 | - **[Team](#team)**
|
7 | 9 | - **[License](#license)**
|
8 | 10 |
|
| 11 | +## Current Node-API version: 8 |
| 12 | + |
| 13 | +(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog) |
| 14 | + |
9 | 15 | <a name="introduction"></a>
|
10 | 16 |
|
11 | 17 | ## Introduction
|
12 | 18 |
|
13 |
| -The **node-api-headers** moldule contains the header files for the C based |
14 |
| -Node-API provided by Node.js. |
| 19 | +**node-api-headers** contains the header files for the C-based Node-API |
| 20 | +provided by Node.js. Node-API is an API for building native addons that |
| 21 | +guarantees the ABI (Application Binary Interface) stability across versions |
| 22 | +of Node.js (see: [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)). |
| 23 | + |
| 24 | +Node-API headers are in the `include` folder. The Node-APIs that provide |
| 25 | +ECMAScript features from native code can be found in `js_native_api_types.h` |
| 26 | +and `js_native_api.h`. The APIs defined in these headers are included in |
| 27 | +`node_api_types.h` and `node_api.h`. |
| 28 | +The headers are structured in this way in order to allow implementations of |
| 29 | +Node-API outside of Node.js considering that for those implementations the |
| 30 | +Node.js specific APIs may not be applicable. |
| 31 | + |
| 32 | +**node-api-headers** is also a package published on **npm** that could be used |
| 33 | +in a process to compile and build native addons for Node.js. |
| 34 | + |
| 35 | +<a name="install"></a> |
| 36 | + |
| 37 | +## Install |
| 38 | + |
| 39 | +``` |
| 40 | +npm i node-api-headers |
| 41 | +``` |
| 42 | + |
| 43 | +<a name="api"></a> |
| 44 | + |
| 45 | +## API |
| 46 | + |
| 47 | +The module exports two properties `include_dir` and `symbols`. |
| 48 | +### `include_dir` |
| 49 | + |
| 50 | +This property is a string that represents the include path for the Node-API |
| 51 | +headers. |
| 52 | + |
| 53 | +### `symbols` |
| 54 | + |
| 55 | +This property is an object that represents the symbols exported by Node-API |
| 56 | +grouped by version and api types. |
| 57 | + |
| 58 | +```js |
| 59 | + V1: { |
| 60 | + js_native_api_symbols: [ |
| 61 | + // List of symbols in js_native_api.h for the version 1. |
| 62 | + ], |
| 63 | + node_api_symbols: [ |
| 64 | + // List of symbols in node_api.h for the version 1 |
| 65 | + ] |
| 66 | + }, |
| 67 | + // ... |
| 68 | +``` |
15 | 69 |
|
16 | 70 | <a name="team"></a>
|
17 | 71 |
|
|
0 commit comments