Chapter 3. The Node Core
Chapter 1 provided a first look at a Node application with the traditional (and always entertaining) Hello, World application. The examples in the chapter made use of a couple of modules from what is known as the Node core: the API providing much of the functionality necessary for building Node applications.
In this chapter, I’m going to provide more detail on the Node core system. It’s not an exhaustive overview, since the API is quite large and dynamic in nature. Instead, we’ll focus on key elements of the API, and take a closer look at those that we’ll use in later chapters and/or are complex enough to need a more in-depth review.
Topics covered in this chapter include:
Node global objects, such as
global,process, andBufferThe timer methods, such as
setTimeoutA quick overview of socket and stream modules and functionality
The
Utilitiesobject, especially the part it plays in Node inheritanceThe
EventEmitterobject and events
Note
Node.js documentation for the current stable release is available at http://nodejs.org/api/.
Globals: global, process, and Buffer
There are several objects available to all Node applications without the user having to incorporate any module. The Node.js website groups these items under the descriptive label of globals.
We’ve been using one global, require, to include modules into our
applications. We’ve also made extensive use of another global, console, to log messages to the console. Other globals are essential to the underlying implementation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access