We will continue learning Node.js in this lesson by going into depth, covering modules essential to back-end development with Node.js. We’ll cover core Node.js modules such as
timer modules. We will also learn how to get user input and output and create readable and writable streams. These topics will not only help you get a deeper understanding of Node.js but will also build on the topics that have been covered thus far.
Review the code in app.js. To see the outputs of the code, type
node app.js in the terminal and press Enter or Return. When you are ready to move on, click “Next”.
Here are some things that are going on in the code:
EventEmitterobjects used to assign listener functions triggered on specified events.
buffermodule is used to handle binary data. In app.js, a
Bufferobject is being created and then converted to a string.
fsmodule is used to interact with the user’s filesystem. In app.js, a statement is logged that verifies that a file was provided in a callback function.
timermodule provides the
setImmediate()function which runs immediately after the current poll phase is completed. Take note of when
'Welcome to Node.js'is logged to the terminal.
Take this course for free