What does Node.js TTY module contains?

The Node.js TTY module contains tty.ReadStream and tty.WriteStream classes. In most cases, there is no need to use this module directly. You have to used require (‘tty’) to access this module. Syntax: var tty = require(‘tty’); The Node.js tty module contains functionality related to terminal input and output. It provides an interface for working with … Read more

What is the Punycode in Node.js?

The Punycode is an encoding syntax which is used to convert Unicode (UTF-8) string of characters to ASCII string of characters. It is bundled with Node.js v0.6.2 and later versions. If you want to use it with other Node.js versions, then use npm to install Punycode module first. You have to used require (‘Punycode’) to … Read more

What is the difference between events and callbacks in Node.js?

Although, Events and Callbacks look similar the differences lies in the fact that callback functions are called when an asynchronous function returns its result whereas event handling works on the observer pattern. Whenever an event gets fired, its listener function starts executing. Node.js has multiple in-built events available through the events module and EventEmitter class … Read more

What is event-driven programming in Node.js?

In Node.js, event-driven programming means as soon as Node starts its server, it initiates its variables, declares functions and then waits for an event to occur. It is one of the reasons why Node.js is pretty fast compared to other similar technologies. In Node.js, event-driven programming is a paradigm where the flow of the program … Read more

What are the streams in Node.js?

The Streams are the objects that facilitate you to read data from a source and write data to a destination. There are four types of streams in Node.js: Readable: This stream is used for reading operations. Writable: This stream is used for write operations. Duplex: This stream can be used for both reading and write … Read more