Variables

arch:String

What processor architecture you're running on: 'arm', 'ia32', or 'x64'.

argv:Array<String>

An array containing the command line arguments. The first element will be node, the second element will be the name of the JavaScript file. The next elements will be any additional command line arguments.

E.g:

$ node process-2.js one two=three four
0: node
1: /Users/mjr/work/node/process-2.js
2: one
3: two=three
4: four

config:Dynamic<Dynamic>

An Object containing the JavaScript representation of the configure options that were used to compile the current node executable. This is the same as the "config.gypi" file that was produced when running the ./configure script.

env:DynamicAccess<String>

An object containing the user environment. See environ(7).

execArgv:Array<String>

This is the set of node-specific command line options from the executable that started the process. These options do not show up in argv, and do not include the node executable, the name of the script, or any options following the script name.

These options are useful in order to spawn child processes with the same execution environment as the parent.

execPath:String

This is the absolute pathname of the executable that started the process.

exitCode:Null<Int>

A number which will be the process exit code, when the process either exits gracefully, or is exited via process.exit() without specifying a code.

Specifying a code to process.exit(code) will override any previous setting of process.exitCode.

read onlymainModule:Module

Alternate way to retrieve require.main. The difference is that if the main module changes at runtime, require.main might still refer to the original main module in modules that were required before the change occurred. Generally it's safe to assume that the two refer to the same module.

As with require.main, it will be undefined if there was no entry script.

noDeprecation:Bool

Disable run-time deprecation warnings. See Util.deprecate.

read onlypid:Int

The PID of the process.

platform:String

What platform you're running on: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'

stderr:IWritable

A writable stream to stderr.

stderr and stdout are unlike other streams in Node in that writes to them are usually blocking.

stdin:IReadable

A Readable Stream for stdin.

stdout:IWritable

A Writable Stream to stdout.

stderr and stdout are unlike other streams in Node in that writes to them are usually blocking.

throwDeprecation:Bool

Throw on deprecated API usage. See Util.deprecate.

title:String

Getter/setter to set what is displayed in 'ps'.

When used as a setter, the maximum length is platform-specific and probably short. On Linux and OS X, it's limited to the size of the binary name plus the length of the command line arguments because it overwrites the argv memory.

traceDeprecation:Bool

Enable logging of deprecation warnings. See Util.deprecate.

read onlyversion:String

A compiled-in property that exposes NODE_VERSION.

versions:DynamicAccess<String>

A property exposing version strings of node and its dependencies.

Methods

abort():Void

This causes node to emit an abort. This will cause node to exit and generate a core file.

chdir(directory:String):Void

Changes the current working directory of the process or throws an exception if that fails.

cwd():String

Returns the current working directory of the process.

disconnect():Void

Close the IPC channel to parent process.

Only available for child processes. See ChildProcess.disconnect.

exit(?code:Int):Void

Ends the process with the specified code. If the code is omitted, exit uses either the 'success' code 0 or the value of process.exitCode if specified.

getgid():Int

Gets the group identity of the process. See getgid(2). Note: this function is only available on POSIX platforms (i.e. not Windows)

getgroups():Array<Int>

Returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective group ID is included but node.js ensures it always is. Note: this function is only available on POSIX platforms (i.e. not Windows)

getuid():Int

Gets the user identity of the process. See getuid(2). Note: this function is only available on POSIX platforms (i.e. not Windows)

hrtime():Array<Float>

hrtime(prev:Array<Float>):Array<Float>

Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array. It is relative to an arbitrary time in the past. It is not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals. You may pass in the result of a previous call to hrtime to get a diff reading, useful for benchmarks and measuring intervals

initgroups(user:EitherType<String, Int>, extra_group:EitherType<String, Int>):Void

Reads /etc/group and initializes the group access list, using all groups of which the user is a member. This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.

Note: this function is only available on POSIX platforms (i.e. not Windows)

kill(pid:Int, ?signal:String):Void

Send a signal to a process. pid is the process id and signal is the string describing the signal to send. Signal names are strings like 'SIGINT' or 'SIGHUP'.

If omitted, the signal will be 'SIGTERM'. See Signal Events and kill(2) for more information.

Will throw an error if target does not exist, and as a special case, a signal of 0 can be used to test for the existence of a process.

Note that just because the name of this function is kill, it is really just a signal sender, like the kill system call. The signal sent may do something other than kill the target process.

memoryUsage():MemoryUsage

Returns an object describing the memory usage of the Node process measured in bytes.

nextTick(callback:() ‑> Void, args:Rest<Dynamic>):Void

On the next loop around the event loop call this callback. This is not a simple alias to setTimeout(fn, 0), it's much more efficient. It typically runs before any other I/O events fire, but there are some exceptions.

This is important in developing APIs where you want to give the user the chance to assign event handlers after an object has been constructed, but before any I/O has occurred.

send(message:Dynamic, ?callback:Error ‑> Void):Bool

send(message:Dynamic, sendHandle:Dynamic, options:ChildProcessSendOptions, ?callback:Error ‑> Void):Bool

send(message:Dynamic, sendHandle:Dynamic, ?callback:Error ‑> Void):Bool

Send a message to the parent process.

Only available for child processes. See ChildProcess.send.

setgid(id:Int):Void

setgid(id:String):Void

Sets the group identity of the process. See setgid(2). This accepts either a numerical ID or a groupname string. If a groupname is specified, this method blocks while resolving it to a numerical ID.

Note: this function is only available on POSIX platforms (i.e. not Windows)

setgroups(groups:Array<EitherType<String, Int>>):Void

Sets the supplementary group IDs. This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.

Note: this function is only available on POSIX platforms (i.e. not Windows) The list can contain group IDs, group names or both.

setuid(id:Int):Void

setuid(id:String):Void

Sets the user identity of the process. See setuid(2). This accepts either a numerical ID or a username string. If a username is specified, this method blocks while resolving it to a numerical ID.

Note: this function is only available on POSIX platforms (i.e. not Windows)

umask(?mask:Int):Int

Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process. Returns the old mask if mask argument is given, otherwise returns the current mask.

uptime():Float

Number of seconds Node has been running.

Inherited Variables

Inherited Methods

Defined by EventEmitter

addListener<T>(eventName:Event<T>, listener:T):TSelf

emit<T>(eventName:Event<T>, args:Rest<Dynamic>):Bool

Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

See also:

eventNames():Array<EitherType<String, Symbol>>

Returns an array listing the events for which the emitter has registered listeners. The values in the array will be strings or Symbols.

See also:

getMaxListeners():Int

Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

See also:

listenerCount<T>(eventName:Event<T>):Int

Returns the number of listeners listening to the event named eventName.

See also:

listeners<T>(eventName:Event<T>):Array<T>

Returns a copy of the array of listeners for the event named eventName.

See also:

off<T>(eventName:Event<T>, listener:T):TSelf

on<T>(eventName:Event<T>, listener:T):TSelf

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

See also:

once<T>(eventName:Event<T>, listener:T):TSelf

Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

See also:

prependListener<T>(eventName:Event<T>, listener:T):TSelf

Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

See also:

prependOnceListener<T>(eventName:Event<T>, listener:T):TSelf

Adds a one-time listener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

See also:

rawListeners<T>(eventName:Event<T>):Array<T>

Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

See also:

removeAllListeners<T>(?eventName:Event<T>):TSelf

Removes all listeners, or those of the specified eventName.

See also:

removeListener<T>(eventName:Event<T>, listener:T):TSelf

Removes the specified listener from the listener array for the event named eventName.

See also:

setMaxListeners(n:Int):Void

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. Obviously, not all events should be limited to just 10 listeners. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

See also: