Skip to main content

WhoAmIResult (interface)​

The type of the return value of whoami.

Example

const user: WhoAmIResult = whoami();
console.log(user.name, user.uid, user.gid);
declare interface WhoAmIResult {
name: string;
uid: number;
gid: number;
}

WhoAmIResult.name (string property)​

name: string;

WhoAmIResult.uid (number property)​

uid: number;

WhoAmIResult.gid (number property)​

gid: number;

whoami (function)​

Get info about the user the yavascript process is executing as.

Provides functionality similar to the unix binaries whoami and id.

NOTE: Doesn't work on Windows; throws an error.

Example

const { name } = whoami();
console.log(`Running as ${name}`);
declare function whoami(): WhoAmIResult;