Open In App

Node.js process.release Property

Last Updated : 12 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The process.release property is an inbuilt application programming interface of the process module which is used to get the metadata related to current release of node.js.
Syntax: 

process.release

Return Value: This property returns an object containing the metadata of current release of nodejs. This object will contain properties like name, sourceUrl, headersUrl, libUrl, and lts. 

  • name: The value of name will always be ‘node’ in Node.js. Its value can be ‘io.js’ for legacy io.js release.
  • sourceUrl: It contains a string representing the absolute URL pointing to the current release sourcecode as ‘.tar.gz’ file.
  • headersUrl: It contains a string representing absolute URL pointing to the current release source header files as ‘.tar.gz’ file. This file is smaller than source code file and can be used for compiling Node.js native addons.
  • libUrl: It contains a string representing absolute URL pointing to ‘node.lib’ file matching the architecture and version of the current release. This file is used to compile Node.js native addons. This property only available in windows builds, may be missing on other platform.
  • lts: A string literals representing latest stable release. Its value can be one of these: 
    • Argon:for the 4.x.x LTS versions
    • Boron:for the 6.x.x LTS versions
    • Carbon:for the 8.x.x LTS versions
    • Dubnium:for the 10.x.x LTS versions

Below examples illustrate the use of process.release property in Node.js:
Example 1: 
 

javascript




// Node.js program to demonstrate the     
// process.release Property
   
// Include process module
const process = require('process');
  
// Printing process.release property value
console.log(process.release);


Output: 

{ name: 'node',
  lts: 'Dubnium',
  sourceUrl:
   'https://nodejs.org/download/release/v10.16.0/node-v10.16.0.tar.gz',
  headersUrl:
   'https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz',
  libUrl:
   'https://nodejs.org/download/release/v10.16.0/win-x64/node.lib' }

Example 2: 

javascript




// Node.js program to demonstrate the     
// process.release Property
   
// Include process module
const process = require('process');
  
// Printing process.release attribute count
var no_attr = 0;
  
// Calling process.release
var release = process.release;
  
// Iterating through all returned data
for (var key in release) {
      
  // Printing key and its releases
  console.log(key + ":\t\t\t" + release[key]);
  no_attr++;
}
  
// Printing count
console.log("Total no of attribute "
    + "available = " + no_attr);


Output: 

name:          node
lts:           Dubnium
sourceUrl:     https://nodejs.org/download/release/v10.16.0/node-v10.16.0.tar.gz
headersUrl:    https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz
libUrl:        https://nodejs.org/download/release/v10.16.0/win-x64/node.lib
Total no of attribute available = 5

Example 3: 

javascript




// Node.js program to demonstrate the     
// process.release Property
   
// Include process module
const process = require('process');
  
// Calling process.release property
var release = process.release;
  
// Printing one data at a time
console.log("lts: " + release.lts);
console.log("source url: " + release.sourceUrl);
console.log("header url: " + release.headersUrl);


Output: 

lts: Dubnium
source url: https://nodejs.org/download/release/v10.16.0/node-v10.16.0.tar.gz
header url: https://nodejs.org/download/release/v10.16.0/node-v10.16.0-headers.tar.gz

Note: The above program will compile and run by using the node filename.js command.
Reference: https://nodejs.org/api/process.html#process_process_release
 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads