File: version_management.md

package info (click to toggle)
node-addon-api 8.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,256 kB
  • sloc: cpp: 15,585; javascript: 5,664; ansic: 157; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# VersionManagement

The `Napi::VersionManagement` class contains methods that allow information
to be retrieved about the version of Node-API and Node.js. In some cases it is
important to make decisions based on different versions of the system.

## Methods

### GetNapiVersion

Retrieves the highest Node-API version supported by Node.js runtime.

```cpp
static uint32_t Napi::VersionManagement::GetNapiVersion(Napi::BasicEnv env);
```

- `[in] env`: The environment in which the API is invoked under.

Returns the highest Node-API version supported by Node.js runtime.

### GetNodeVersion

Retrieves information about Node.js version present on the system. All the
information is stored in the `napi_node_version` structure that is defined as
shown below:

```cpp
typedef struct {
  uint32_t major;
  uint32_t minor;
  uint32_t patch;
  const char* release;
} napi_node_version;
````

```cpp
static const napi_node_version* Napi::VersionManagement::GetNodeVersion(Napi::BasicEnv env);
```

- `[in] env`: The environment in which the API is invoked under.

Returns the structure a pointer to the structure `napi_node_version` populated by
the version information of Node.js runtime.