Node.js globals

Static variables

staticread only__dirname:String

This variable may appear to be global but is not. See __dirname.

staticread only__filename:String

This variable may appear to be global but is not. See __filename.

staticread onlyconsole:Console

Used to print to stdout and stderr. See the console section.

staticread onlyexports:Dynamic<Dynamic>

This variable may appear to be global but is not. See exports.

@:value(cast Node)staticinlineread onlyglobal:Dynamic<Dynamic> = cast Node

In browsers, the top-level scope is the global scope. This means that within the browser var something will define a new global variable. In Node.js this is different. The top-level scope is not the global scope; var something inside a Node.js module will be local to that module.

staticread onlymodule:Module

This variable may appear to be global but is not. See module.

staticread onlyprocess:Process

The process object. See the process object section.

Static methods

staticclearImmediate(immediate:Immediate):Void

clearImmediate is described in the timers section.

staticclearInterval(timeout:Timeout):Void

clearInterval is described in the timers section.

staticclearTimeout(timeout:Timeout):Void

clearTimeout is described in the timers section.

staticqueueMicrotask(callback:() ‑> Void):Void

The queueMicrotask() method queues a microtask to invoke callback. If callback throws an exception, the process object 'uncaughtException' event will be emitted.

The microtask queue is managed by V8 and may be used in a similar manner to the Process.nextTick() queue, which is managed by Node.js. The Process.nextTick() queue is always processed before the microtask queue within each turn of the Node.js event loop.

staticinlinerequire(module:String):Dynamic

This variable may appear to be global but is not. See require().

staticsetImmediate(callback:Function, args:Rest<Dynamic>):Immediate

setImmediate is described in the timers section.

staticsetInterval(callback:Function, delay:Int, args:Rest<Dynamic>):Timeout

setInterval is described in the timers section.

staticsetTimeout(callback:Function, delay:Int, args:Rest<Dynamic>):Timeout

setTimeout is described in the timers section.