Open In App

Node.js process.release Property

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. 



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




// 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: 




// 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: 




// 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
 


Article Tags :