process.release


process.release 属性返回一个 Object,其中包含与当前版本相关的元数据,包括源代码压缩包和仅包含头文件的压缩包的 URL。

【The process.release property returns an Object containing metadata related to the current release, including URLs for the source tarball and headers-only tarball.】

process.release 包含以下属性:

  • name <string> 一个值,始终为 'node'
  • sourceUrl <string> 是指向包含当前版本源代码的 .tar.gz 文件的绝对 URL。
  • headersUrl<string> 是一个指向 .tar.gz 文件的绝对 URL,该文件仅包含当前版本的源头头文件。该文件比完整的源文件小得多,可用于编译 Node.js 原生插件。
  • libUrl <string> | <undefined> 是指向与当前版本架构和版本匹配的 node.lib 文件的绝对 URL。该文件用于编译 Node.js 原生插件。此属性仅存在于 Windows 版本的 Node.js 上,在其他所有平台上均不存在.
  • lts <string> | <undefined> 是一个字符串标签,用于标识此版本的 长期支持 标签。此属性仅存在于 LTS 版本中,对于其他所有版本类型(包括 Current 版本),其值为 undefined。有效值包括 LTS 版本代号(包括那些不再受支持的版本)。
    • 'Fermium' 适用于从 14.15.0 开始的 14.x LTS 系列。
    • ‘Gallium’ 适用于从 16.13.0 开始的 16.x LTS 系列。
    • 'Hydrogen' 指的是从 18.12.0 开始的 18.x LTS 版本。有关其他 LTS 版本代号,请参见 Node.js 更新日志存档
{
  name: 'node',
  lts: 'Hydrogen',
  sourceUrl: 'https://nodejs.cn/download/release/v18.12.0/node-v18.12.0.tar.gz',
  headersUrl: 'https://nodejs.cn/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
  libUrl: 'https://nodejs.cn/download/release/v18.12.0/win-x64/node.lib'
} 

在非发布版本源码树的自定义构建中,可能只有 name 属性存在。其他附加属性不应被依赖为一定存在。

【In custom builds from non-release versions of the source tree, only the name property may be present. The additional properties should not be relied upon to exist.】