Programming

Programming

Exploring Various Coding Languages

Programming LanguagesSoftware DevelopmentAlgorithms and Data StructuresSoftware EngineeringWeb and Mobile Programming

Articles in this Section

The node:module API in Node.js

The node:module API provides general utility methods for interacting with Node.js modules. It allows developers to inspect built-in modules, create require functions inside ES modules, locate package.json files, register custom hooks to modify module resolution and loading behavior, synchronize CommonJS and ESM exports, and enable compile caching to improve performance.

/article/the-nodemodule-api-in-nodejs

Packages in Node.js

A package in Node.js is a folder tree described by a package.json file. The package consists of the folder containing the package.json file and all subfolders until another folder with its own package.json or a node_modules folder is encountered. The package.json file defines how .js files are interpreted (as CommonJS or ES modules), specifies entry points, and controls exports and imports. Node.js supports both CommonJS and ES modules, and package authors can use fields like type, main, exports, and imports to configure behavior.

/article/packages-in-nodejs

TypeScript Support in Node.js

Node.js provides two ways to run TypeScript files: full support via third-party packages, or lightweight built-in support through type stripping. Full support allows all TypeScript features (including tsconfig.json) using tools like tsx. Type stripping, on the other hand, removes inline types without type checking or complex transformations, enabling quick execution of .ts files. Node.js supports both CommonJS and ES modules in TypeScript, with module system determined by file extensions and package.json settings.

/article/typescript-support-in-nodejs

The Net Module in Node.js

The node:net module provides an asynchronous networking API for creating stream-based TCP or IPC servers and clients. It supports inter-process communication (IPC) with named pipes on Windows and Unix domain sockets on other operating systems. With classes like net.Server, net.SocketAddress, and net.BlockList, developers can build servers, manage connections, and control access to IP addresses.

/article/the-net-module-in-nodejs

The OS Module in Node.js

The node:os module provides operating system-related utility methods and properties. It enables developers to query CPU architecture, memory usage, system paths, user information, and constants for signals and errors. This module helps applications adapt to the environment they run in by exposing system-level details.

/article/the-os-module-in-nodejs

The Path Module in Node.js

The node:path module provides utilities for working with file and directory paths. It allows developers to parse, format, normalize, join, and resolve paths in a way that adapts to the operating system. To ensure consistent results across platforms, Node.js offers path.win32 for Windows-style paths and path.posix for POSIX-style paths.

/article/the-path-module-in-nodejs

Performance Measurement APIs in Node.js

The node:perf_hooks module implements a subset of the W3C Web Performance APIs along with Node.js-specific extensions for measuring application performance. It provides tools for high-resolution timing, performance marks and measures, resource timing, and event loop utilization. These APIs help developers analyze execution time, identify bottlenecks, and optimize applications.

/article/performance-measurement-apis-in-nodejs

Permissions in Node.js

The Node.js Permission Model provides a mechanism to restrict process access to system resources. It acts as a "seat belt," preventing trusted code from unintentionally modifying files or using resources without explicit permission. However, it does not guarantee protection against malicious code, which can bypass restrictions. Developers can configure permissions at startup or check them at runtime.

/article/permissions-in-nodejs

The Process Object in Node.js

The process object in Node.js provides information about and control over the current Node.js process. It is an instance of EventEmitter and supports a wide range of events such as exit, beforeExit, uncaughtException, and system signals. It also exposes methods and properties for CPU architecture, command-line arguments, memory usage, working directory, and inter-process communication (IPC).

/article/the-process-object-in-nodejs

The Punycode Module in Node.js

The punycode module in Node.js is a bundled implementation of the Punycode.js library, based on RFC 3492. It provides encoding and decoding functionality for Internationalized Domain Names (IDNs), converting Unicode characters into ASCII-compatible strings. Since hostnames in URLs must be ASCII-only, Punycode is used to represent non-ASCII domain names. However, the module has been deprecated since Node.js v7.0.0 and will be removed in future versions. Developers should migrate to the standalone Punycode.js library or use modern alternatives such as the WHATWG URL API.

/article/the-punycode-module-in-nodejs

The Readline Module in Node.js

The readline module in Node.js provides an interface for reading data from a Readable stream (such as process.stdin) line by line. It is widely used for building command-line interfaces (CLIs), handling user input, and processing files line-by-line. Node.js supports both Promise-based APIs and Callback-based APIs for working with readline.

/article/the-readline-module-in-nodejs

The REPL Module in Node.js

The repl module in Node.js provides a Read-Eval-Print-Loop (REPL) environment that can be used as a standalone program or embedded within applications. It allows developers to interactively execute JavaScript code, inspect results, and experiment with Node.js features. REPL supports input completion, history, multi-line editing, ANSI-styled output, error recovery, and custom evaluation functions.

/article/the-repl-module-in-nodejs