All NodeJs Core Modules


A module is any file or directory in the node_modules the directory that can be loaded by the Node.js require() function.

To be loaded by the Node.js require() function, a module must be one of the following:
  1. A folder with a package.json file containing a "main" field.
  2. A folder with an index.js file in it.
  3. A JavaScript file.
Note: Since modules are not required to have a package.json file, not all modules are packages. Only modules that have a package.json file are also packages.

In the context of a Node program, the module is also the thing that was loaded from a file. For example, in the following program:

var req = require('request')

we might say that “The variable req refers to the request module”.

All NodeJs Core Modules At-a-glance


The assert module provides a simple set of assertion tests that can be used to test invariants.


Prior to the introduction of TypedArray in ECMAScript 2015 (ES6), the JavaScript language had no mechanism for reading or manipulating streams of binary data. The Buffer class was introduced as part of the Node.js API to make it possible to interact with octet streams in the context of things like TCP streams and file system operations.

Now that TypedArray has been added in ES6, the Buffer class implements the Uin t8Array API in a manner that is more optimized and suitable for Node.js' use cases.


Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the require() function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries.


The child_process module provides the ability to spawn child processes in a manner that is similar, but not identical, to popen(3).


A single instance of Node.js runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node.js processes to handle the load. The cluster module allows you to easily create child processes that all share server ports.


The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.


The crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions.


Node.js may deprecate APIs when either: (a) use of the API is considered to be unsafe, (b) an improved alternative API has been made available, or (c) breaking changes to the API are expected in a future major release.


The dns module contains functions belonging to two different categories:

1. Functions that use the underlying operating system facilities to perform name resolution, and that do not necessarily perform any network communication. This category contains only one function: dns.lookup().

2. Functions that connect to an actual DNS server to perform name resolution, and that always use the network to perform DNS queries. This category contains all functions in the dns module except dns.lookup().


This module is pending deprecation. Once a replacement API has been finalized, this module will be fully deprecated. Most end-users should not have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being but should expect to have to migrate to a different solution in the future.


Much of the Node.js core API is built around an idiomatic asynchronous event-driven architecture in which certain kinds of objects (called "emitters") periodically emit named events that cause Function objects ("listeners") to be called.


File I/O is provided by simple wrappers around standard POSIX functions. To use this module do require('fs'). All the methods have asynchronous and synchronous forms.


The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses--the user is able to stream data.


HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a separate module.


Node.js has a simple module loading system. In Node.js, files and modules are in one-to-one correspondence (each file is treated as a separate module).


The net module provides you with an asynchronous network wrapper. It contains functions for creating both servers and clients (called streams). You can include this module with require('net');.


The os module provides a number of operating system-related utility methods.


The path module provides utilities for working with file and directory paths.


The version of the punycode module bundled in Node.js is being deprecated.


The querystring module provides utilities for parsing and formatting URL query strings.


The readline module provides an interface for reading data from a Readable stream (such as process.stdin) one line at a time.


The repl module provides a Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications.


A stream is an abstract interface for working with streaming data in Node.js. The stream module provides a base API that makes it easy to build objects that implement the stream interface.

There are many stream objects provided by Node.js. For instance, a request to an HTTP server and process.stdout are both stream instances.


The string_decoder module provides an API for decoding Buffer objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters.


The timer module exposes a global API for scheduling functions to be called at some future period of time. Because the timer functions are globals, there is no need to call require('timers') to use the API.

The timer functions within Node.js implement a similar API as the timers API provided by Web Browsers but use a different internal implementation that is built around the Node.js Event Loop.


The tls module provides an implementation of the Transport Layer Security (TLS) and Secure Socket Layer (SSL) protocols that are built on top of OpenSSL.


Trace Event provides a mechanism to centralize tracing information generated by V8, Node core, and userspace code.

Tracing can be enabled by passing the --trace-events-enabled flag when starting a Node.js application.


The tty module provides the tty. ReadStream and tty.  WriteStream classes. In most cases, it will not be necessary or possible to use this module directly.


The dgram module provides an implementation of UDP Datagram sockets.


The url module provides utilities for URL resolution and parsing.


The util module is primarily designed to support the needs of Node.js' own internal APIs. However, many of the utilities are useful for application and module developers as well.


The v8 module exposes APIs that are specific to the version of V8 built into the Node.js binary.

Note: The APIs and implementation are subject to change at any time.


The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts. JavaScript code can be compiled and run immediately or compiled, saved, and run later.

Note: The vm module is not a security mechanism. Do not use it to run untrusted code.


The zlib module provides compression functionality implemented using Gzip and Deflate/Inflate.


Post a Comment

Post a Comment (0)