CPCODELAB
Node.js

Core Modules Overview

6 min read

Core Modules Overview

Node.js ships with a rich set of built-in (core) modules — no npm install required. They cover file system access, HTTP networking, streams, cryptography, OS information, path manipulation, and more. You load them with require("moduleName") or import.

  • fs — read, write, watch files and directories
  • path — join, resolve, parse file paths cross-platform
  • http / https — create HTTP(S) servers and make requests
  • os — CPU count, total memory, hostname, platform
  • events — EventEmitter class for pub/sub patterns
  • stream — readable, writable, and transform streams
  • crypto — hashing, encryption, random bytes
  • url — parse and format URLs
  • process — environment variables, argv, exit codes
  • child_process — spawn subprocesses and shell commands

In Node.js v14+ you can prefix core modules with node: (e.g. import fs from "node:fs") to make it explicit that you are importing a built-in, not an npm package.

Ready to test yourself?
Practice Node.js— quiz & coding exercises