Skip to content

Commit d68505e

Browse files
authored
Merge pull request #4 from NickNaso/docs
improved documentation and fix on include_dir.
2 parents 15b9d14 + 658e062 commit d68505e

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,69 @@
33
- **[Introduction](#introduction)**
44
- **[Contributing](CONTRIBUTING.md)**
55
- **[Code of Conduct](CODE_OF_CONDUCT.md)**
6+
- **[Install](#install)**
7+
- **[API](#api)**
68
- **[Team](#team)**
79
- **[License](#license)**
810

11+
## Current Node-API version: 8
12+
13+
(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
14+
915
<a name="introduction"></a>
1016

1117
## Introduction
1218

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+
```
1569

1670
<a name="team"></a>
1771

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const path = require('path');
44
const symbols = require('./symbols')
55

6-
const include_dir = path.relative('.', __dirname, 'include');
6+
const include_dir = path.resolve(__dirname, 'include');
77

88
module.exports = {
99
include_dir,

0 commit comments

Comments
 (0)