The next object we are interested in is EventEmitter, or, as it is sometimes called, EE. EventEmitter is a basic object that executes work with events in Node.js. A great number of other built-in objects generating events inherit from it. To use EventEmitter you only need to connect the built-in “events” module and take a respective property from it (let us create ee.js);
Now let us talk on another built-in module named console. As far as we know, it uses util.format and util.inspect for activation. Console, unlike util, is a global variable. It is almost an exception for Node.js, but the fact is that we don’t have to require this сonsole. It is simply everywhere.
Hey all! Our upcoming articles will be devoted to the most frequently used Node.js modules. The first method that we will study is the util inspect of a module built in util. This method enables you to beautifully derive any object, even if this object – as it is shown in our example – has a link to itself.
Let us continue our conversation about NPM. To look at a real package.json install an express module. Enter in the console: npm i firstname.lastname@example.org We will use this module later, but now we just install this outside module and take a look at its package.json. We are going to find out a lot of interesting things there. Here I will comment on several lines of this file. We will learn some basic characteristics of package.json, some general information this time. Later, when we start developing something particular, we will use it in our solutions. So, our fields…
This article is devoted to NPM – a package manager for Node.JS. NPM goes with a standard Node installation. If you’ve already installed Node, it means that NPM is installed on your PC, too. This module, on top of everything else, contains a console utility that gives a handy access to a giant database of modules supported by the community.
Let us start our lesson with understanding what a module object is. It contains a great variety of important properties, which will be needed in more complex and complicated behavior scenarios. You can download the source code from here. An object called ‘module’ is a variable that exists in every module.