Various modules of node.js contain global objects that we do not require to install them whenever we want to use them in our application. They are available to be used directly. Global objects include modules, functions, strings and an object itself.
_filename: the _filename indicate the code of the file under execution. It is the absolute path of the code of the file. it becomes unavoidably the same when working with the main program. If you want to know it, it is found inside a module. When you have a code and execute it, its file path is printed on the console.
_dirname: the _dirname indicate the directory name in execution of a script. On logging on to this particular string, the value will be printing its absolute directory path where the script file exists on the machine and it will be displayed on the console.
Function setTimeout (callback, milliseconds): this particular object is used to run call back when specific time of waiting has passed. It is only available in two parameters; OS timer granularity and the system load. It can only hold up to a time of 24.8 days.
Function clearTimeout (time): this function is the one that is used to stop the above timer that was set previously. The parameter therefore will be the timer that should be returned by settimeout() function. It clears the timeout function.
Function setInterval (callback, milliseconds): this function is used to run call back over and over again after the set time interval is reached. There are two parameters involved that will determine this and they are; OS timer granularity and system load. Maximum time given for this is 24.8 days.
Console: it is used for printing information on the stdout and stderr.
Process: it is used for getting information about the current process. It can give multiple events that are related to process activities.
It is important to note node.js has all these global objects that can be accessed globally but some exist only in module level in every level.
[vc_row][vc_column][td_block_21 separator=”” tag_slug=”node-js” limit=”40″ tdc_css=””][/vc_column][/vc_row]