Programming

Programming

Exploring Various Coding Languages

Programming LanguagesSoftware DevelopmentAlgorithms and Data StructuresSoftware EngineeringWeb and Mobile Programming

Articles in this Section

Internationalization Support in Node.js with ICU

Node.js provides extensive features for writing internationalized applications. These include locale-sensitive functions in ECMAScript, the Intl object, Unicode-aware string methods, internationalized domain name (IDN) support in the WHATWG URL parser, and utilities like TextDecoder, buffer.transcode(), and RegExp Unicode property escapes. These capabilities are powered by the V8 engine and the ICU (International Components for Unicode) library. Depending on how Node.js is built, ICU data can be embedded fully, partially, or disabled entirely.

/article/internationalization-support-in-nodejs-with-icu

CommonJS Modules in Node.js

CommonJS modules are the original way of packaging JavaScript code in Node.js. . Each file is treated as a separate module, and modules can be imported using require(). Exports are defined using exports or module.exports. This system allows developers to organize code, manage dependencies, and reuse functionality across applications.

/article/commonjs-modules-in-nodejs

ECMAScript Modules in Node.js

ECMAScript modules (ESM) are the official standard for packaging JavaScript code for reuse. They use import and export statements and are fully supported in Node.js, alongside interoperability with CommonJS. Node.js allows developers to explicitly mark files as ES modules using .mjs, the "type": "module" field in package.json, or the --input-type=module flag. ES modules provide modern features such as dynamic imports, import.meta properties, and support for JSON and WASM imports.

/article/ecmascript-modules-in-nodejs

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