jsguides

Reference

Node.js Modules

Core Node.js modules and APIs.

  1. assert

    Node.js assert module — strict vs legacy mode, AssertionError, deep equality, throws/rejects, and Assert instances.

  2. Buffer

    Work with binary data in Node.js using the Buffer class. Covers memory allocation, numeric reads and writes, encoding conversions, and TypedArray interop.

  3. child_process

    Spawn subprocesses and run shell commands in Node.js with the child_process module's spawn, exec, fork, and sync APIs.

  4. child_process module

    Node.js child_process module for spawning external processes, executing shell commands, and forking Node.js processes.

  5. cluster

    Reference for node:cluster: cluster.fork, setupPrimary, isPrimary, Worker events, scheduling policies, and graceful shutdown.

  6. crypto module

    Node.js crypto module for cryptographic operations including hashing, ciphers, HMAC signing, key derivation, and cryptographically secure random generation.

  7. diagnostics_channel

    Node.js diagnostics_channel module: named pub/sub channels for libraries to publish structured diagnostic data and APM tools to subscribe to it.

  8. events module

    Node.js events module for event-driven architecture. The EventEmitter class for emitting and handling custom events.

  9. fs module

    Node.js fs module for file I/O, directory management, and file watching, with callback, synchronous, and promise-based APIs.

  10. fs/promises module

    Promise‑based file system API for Node.js. All fs functions return promises, enabling clean async/await code without callbacks.

  11. node:http

    The node:http module provides HTTP server and client functionality in Node.js, built on streams for handling requests, responses, routing, and JSON APIs.

  12. node:https

    Node.js HTTPS client and server module with TLS/SSL encryption, custom certificate authorities, mutual TLS authentication, and secure API requests.

  13. node:test

    Node.js built-in test runner with test()/it(), suites, hooks, subtests, mocks, mock timers, snapshot assertions, code coverage, and CLI flags.

  14. node:url

    Node.js URL parsing, resolution, and manipulation with the WHATWG URL class. Covers URL construction, query string handling, relative resolution and validation.

  15. os module

    The os module provides operating system-related utility methods for accessing platform information, CPU architecture, memory, and network interfaces.

  16. path module

    The path module provides utilities for working with file and directory paths in a way that works across different operating systems.

  17. process

    The process object provides information about and control over the current Node.js process, including argv, env, and methods to exit or signal the process.

  18. readline module

    Node.js readline module for reading streams line by line, building interactive command-line interfaces, and processing large files efficiently in Node.js.

  19. stream

    Comprehensive reference for Node.js streams covering readable, writable, transform, and duplex streams with backpressure handling and pipeline patterns.

  20. timers

    Node.js timers module: setTimeout, setInterval, setImmediate, plus the timers/promises Promise-based API and the Timeout class.

  21. worker_threads

    Node.js worker_threads module: Worker, MessageChannel, MessagePort, BroadcastChannel, and helpers for CPU-bound JavaScript tasks.