|
||
---|---|---|
.. | ||
docs | ||
lib | ||
package.json | ||
README.md |
getuid
Return the numeric user identity of the calling process.
Usage
var getuid = require( '@stdlib/process/getuid' );
getuid()
Returns the numeric user identity of the calling process.
var id = getuid();
Notes
- The function only returns an
integer
user identity on POSIX platforms. For all other platforms (e.g., Windows, browsers, and Android), the function returnsnull
. - See getuid(2).
Examples
var getuid = require( '@stdlib/process/getuid' );
var uid = getuid();
if ( uid === 0 ) {
console.log( 'Likely running as root.' );
} else {
console.log( 'uid: %d', uid );
}