napi_get_node_version
typedef struct {
uint32_t major;
uint32_t minor;
uint32_t patch;
const char* release;
} napi_node_version;
napi_status napi_get_node_version(napi_env env,
const napi_node_version** version);
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[out] version
:指向 Node.js 本身版本信息的指针。¥
[out] version
: A pointer to version information for Node.js itself.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此函数用当前运行的 Node.js 的主要、次要和补丁版本填充 version
结构,并用 process.release.name
的值填充 release
字段。
¥This function fills the version
struct with the major, minor, and patch
version of Node.js that is currently running, and the release
field with the
value of process.release.name
.
返回的缓冲区是静态分配的,不需要释放。
¥The returned buffer is statically allocated and does not need to be freed.