process.release


process.release 属性返回与当前发布相关的元数据 Object,包括源代码和源代码头文件 tarball 的 URL。

process.release 包括如下属性:

  • name <string> 此值始终为 'node'
  • sourceUrl <string> 指向一个_.tar.gz_文件的绝对 URL,包括了当前发布的源代码。
  • headersUrl<string> 指向一个_.tar.gz_文件的绝对 URL,包括了当前发布的源代码的头文件信息。 这个文件要比全部源代码文件明显小很多,可以用于编译 Node.js 原生插件。
  • libUrl <string> 指向一个_node.lib_文件的绝对 URL,匹配当前发布的结构和版本信息。此文件用于编译 Node.js 本地插件。这个属性只在 Windows 版本中存在,在其他平台中无效。
  • lts <string> 标识当前发布的 LTS 标签的字符串。

 只有 LTS 版本存在这个属性,其他所有版本类型(包括当前版本)这个属性都是 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 Codenames (including those that are no longer supported). A non-exhaustive example of these codenames includes:
    • '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 Codenames, 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.