diff options
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r-- | doc/api/n-api.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index af3696fd10..9e7fdd9301 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3285,6 +3285,35 @@ callback invocation, even if it has been successfully cancelled. ## Version Management +### napi_get_node_version +<!-- YAML +added: REPLACEME +--> + +```C +typedef struct { + uint32_t major; + uint32_t minor; + uint32_t patch; + const char* release; +} napi_node_version; + +NAPI_EXTERN +napi_status napi_get_node_version(napi_env env, + const napi_node_version** version); +``` + +- `[in] env`: The environment that the API is invoked under. +- `[out] version`: A pointer to version information for Node itself. + +Returns `napi_ok` if the API succeeded. + +This function fills the `version` struct with the major, minor and patch version +of Node that is currently running, and the `release` field with the +value of [`process.release.name`][`process.release`]. + +The returned buffer is statically allocated and does not need to be freed. + ### napi_get_version <!-- YAML added: v8.0.0 @@ -3368,3 +3397,5 @@ support it: [`napi_throw_type_error`]: #n_api_napi_throw_type_error [`napi_unwrap`]: #n_api_napi_unwrap [`napi_wrap`]: #n_api_napi_wrap + +[`process.release`]: process.html#process_process_release |