process.release


process.release 属性返回 Object,其中包含与当前版本相关的元数据,包括源 tarball 和 headers-only tarball 的网址。

process.release 包含以下属性:

  • name <string> 始终为 'node' 的值。
  • sourceUrl <string> 指向包含当前版本源代码的 .tar.gz 文件的绝对网址。
  • headersUrl<string> 指向 .tar.gz 文件的绝对网址,该文件仅包含当前版本的源头文件。 该文件比完整的源文件小得多,可用于编译 Node.js 原生插件。
  • libUrl <string> 指向与当前版本的体系结构和版本匹配的 node.lib 文件的绝对网址。 此文件用于编译 Node.js 原生插件。 此属性仅存在于 Windows 构建的 Node.js 中,在所有其他平台上将缺失。
  • lts <string> 标识此版本的 LTS 标签的字符串标签。 此属性仅适用于 LTS 版本,对于所有其他版本类型(包括 Current 版本)为 undefined。 有效值包括 LTS 版本代码名称(包括不再受支持的代码名称)。
    • 'Dubnium' 表示以 10.13.0 开头的 10.x LTS 行。
    • 'Erbium' 表示以 12.13.0 开头的 12.x LTS 行。其他 LTS 版本代码名称,请参见 Node.js 更新日志存档
{
  name: 'node',
  lts: 'Erbium',
  sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
  headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
  libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
}

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

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 contains the following properties:

  • name <string> A value that will always be 'node'.
  • sourceUrl <string> an absolute URL pointing to a .tar.gz file containing the source code of the current release.
  • headersUrl<string> an absolute URL pointing to a .tar.gz file containing only the source header files for the current release. This file is significantly smaller than the full source file and can be used for compiling Node.js native add-ons.
  • libUrl <string> an absolute URL pointing to a node.lib file matching the architecture and version of the current release. This file is used for compiling Node.js native add-ons. This property is only present on Windows builds of Node.js and will be missing on all other platforms.
  • lts <string> a string label identifying the LTS label for this release. This property only exists for LTS releases and is undefined for all other release types, including Current releases. Valid values include the LTS Release code names (including those that are no longer supported).
    • 'Dubnium' for the 10.x LTS line beginning with 10.13.0.
    • 'Erbium' for the 12.x LTS line beginning with 12.13.0. For other LTS Release code names, see Node.js Changelog Archive
{
  name: 'node',
  lts: 'Erbium',
  sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
  headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
  libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
}

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.