Node.js process.geteuid() Method
Last Updated :
12 Oct, 2021
Improve
The process.geteuid() method is an inbuilt application programming interface of the process module which is used to get the numerical effective user identity of the Node.js process.
Syntax:
javascript
Output:
javascript
Output:
process.geteuid()Parameters: This method does not accept any parameters. Return Value: This method returns an object specifying the numerical effective user identity of the Node.js process. Note: This method will only work on POSIX platforms. Not available on windows or android platforms so will cause an error i.e. TypeError, geteuid is not a function. Below examples illustrate the use of process.geteuid() method in Node.js: Example 1:
// Node.js program to demonstrate the
// process.geteuid() method
// Include process module
const process = require('process');
// Printing the numerical effective
// user identity of the Node.js process
console.log(process.geteuid());
6693036Example 2:
// Node.js program to demonstrate the
// process.geteuid() method
// Include process module
const process = require('process');
// Check whether the method exists or not
if (process.geteuid) {
// Printing geteuid() value
console.log("The numerical effective user "
+ "identity of the Node.js process:"
+ process.geteuid());
}
The numerical effective user identity of the Node.js process: 6693036Note: The above program will compile and run by using the
node filename.js
command.
Reference: https://nodejs.org/api/process.html#process_process_geteuid