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