Node.js Global ObjectsNode.js global objects are global in nature and available in all modules. You don't need to include these objects in your application; rather they can be used directly. These objects are modules, functions, strings and object etc. Some of these objects aren't actually in the global scope but in the module scope. A list of Node.js global objects are given below:
Node.js __dirnameIt is a string. It specifies the name of the directory that currently contains the code. File: global-example1.js Open Node.js command prompt and run the following code: Node.js __filenameIt specifies the filename of the code being executed. This is the resolved absolute path of this code file. The value inside a module is the path to that module file. File: global-example2.js Open Node.js command prompt and run the following code: Node.js ConsoleClick here to get details of Console class. http://www.javatpoint.com/nodejs-console Node.js BufferClick here to get details of Buffer class. http://www.javatpoint.com/nodejs-buffers Node.js Timer FunctionsClick here to get details of Timer functions. http://www.javatpoint.com/nodejs-timer Next TopicNode.js OS |