Built-in Module Quick Reference
Node ships with over 40 built-in modules You don't need to memorize every API but you need to know what exists so you don't reinvent the wheel Here's every core module grouped by category with what it does and when to use it
I/O Modules
| Module | Description | Key exports | When to use |
| fs | File system operations | readFile , writeFile , createReadStream , mkdir , stat , watch | Everything file-related |
| path | Path manipulation | join , resolve , basename , dirname , extname , parse | Always - never hardcode paths |
| stream | Streaming data API | Readable , Writable , Transform , Duplex , pipeline | Large data , piping between I/O |
| buffer | Binary data handling | Buffer , Buffer.alloc , Buffer.from , Buffer.concat | Binary data , network protocols |
| readline | Read line-by-line | createInterface | Process large text files line by line |
| string_decoder | Decode buffers to strings | StringDecoder | Proper multi-byte UTF-8 decoding |
| zlib | Compression/decompression | gzip , gunzip , deflate , inflate , brotliCompress | Compress HTTP responses , files |
| crypto | Cryptography | randomBytes , createHash , createHmac , createCipheriv , sign , verify | Hashing , encryption , token generation |
Network Modules
| Module | Description | Key exports | When to use |
| http | HTTP client and server | createServer , request , get | REST APIs , HTTP services |
| https | HTTPS client and server | createServer , request , get | Secure HTTP - always use in production |
| http2 | HTTP/2 client and server | createServer , connect | gRPC , low-latency APIs |
| net | TCP client and server | createServer , connect | Raw TCP , custom protocols |
| dns | DNS resolution | lookup , resolve , resolve4 , resolve6 , reverse | Domain lookups , email validation |
| dgram | UDP communication | createSocket | DNS servers , real-time protocols , broadcasting |
| tls | TLS/SSL encryption | createServer , connect , TLSSocket | Secure TCP , certificate verification |
| url | URL parsing and formatting | URL , URLSearchParams , parse , format | Working with URLs (always use URL class) |
System Modules
| Module | Description | Key exports | When to use |
| os | Operating system info | cpus , totalmem , freemem , hostname , platform , homedir | Thread pool sizing , system info |
| process | Current process control | argv , env , exit , cpuUsage , memoryUsage , uptime | CLI apps , monitoring |
| child_process | Spawn child processes | spawn , exec , execFile , fork | Running external commands |
| cluster | Multi-process load balancing | fork , isMaster , isPrimary | Scaling HTTP across CPU cores |
| worker_threads | Thread-based parallelism | Worker , parentPort , workerData , SharedArrayBuffer | CPU-intensive work |
| perf_hooks | Performance measurement | performance , PerformanceObserver , createHistogram | Profiling , timing |
| v8 | V8 engine access | getHeapStatistics , setFlagsFromString , serialize | Memory debugging , serialization |
| vm | Virtual machine context | createContext , runInContext , runInNewContext | Sandboxed code execution |
| wasi | WebAssembly System Interface | WASI | Rust/AssemblyScript in Node |
| tty | Terminal I/O | WriteStream , ReadStream , isatty | CLI tools - detect terminal , colors |
Data Modules
| Module | Description | Key exports | When to use |
| querystring | Query string parsing | parse , stringify , escape , unescape | Legacy query parsing (prefer URL) |
| punycode | Unicode encoding | encode , decode , toASCII , toUnicode | International domain names |
| util | General utilities | promisify , callbackify , types , inspect , inherits | Debugging , type checking |
| assert | Testing assertions | strict , ok , equal , deepEqual , throws , rejects | Writing tests |
| events | Event system | EventEmitter , once , getEventListeners | Custom event-driven code |
Control Flow Modules
| Module | Description | Key exports | When to use |
| timers | Delayed execution | setTimeout , setInterval , setImmediate , queueMicrotask | Throttling , debouncing , scheduling |
| async_hooks | Async resource tracking | createHook , executionAsyncId , triggerAsyncId | Advanced diagnostic , APM tools |
| diagnostics_channel | Pub/sub diagnostic channel | channel , subscribe , hasSubscribers | Cross-module observability |
| Module | Description | Key exports | When to use |
| report | Diagnostic report | writeReport , getReport , triggerReport | Crash diagnostics , memory analysis |
| inspector | Debugging protocol | open , close , url , Sessions | Custom debugging tools |
| trace_events | Trace event instrumentation | createTracing | Performance analysis |
| module | Module system internals | builtinModules , Module , createRequire , findSourceMap | Module loading customization |
| console | Debug output | log , error , warn , table , time , trace , dir | Everything debug |
Security-Critical Modules
| Module | Key Security Properties |
| crypto | Use for hashing (SHA-256+) , encryption (AES-256-GCM) , random bytes |
| tls | Always verify certificates , set rejectUnauthorized: true |
| https | Always use https over http in production |
| vm | NOT a security sandbox - code can escape the context |
| child_process | Command injection via shell - use spawn with arrays |
| fs | Path traversal - validate user-provided paths |
| net | No built-in encryption - use tls wrapper for sensitive data |
Module Loading
// CommonJS (default in Node)
const fs = require('fs')
// ESM (ES Modules)
import fs from 'node:fs'
import { readFile } from 'node:fs/promises'
// Built-in modules use the 'node:' scheme (recommended in ESM)
import { createServer } from 'node:http'
The node: prefix is supported in Node 16+ and makes built-in imports explicit Required: node:fs , optional-style: fs (both work)
Quick Start Import Patterns
// Most commonly used imports
const fs = require('fs')
const fsPromises = require('fs/promises')
const path = require('path')
const { EventEmitter } = require('events')
const { spawn } = require('child_process')
const http = require('http')
const https = require('https')
const crypto = require('crypto')
const os = require('os')
const util = require('util')
const { pipeline } = require('stream/promises')
const { Worker } = require('worker_threads')
Prerequisites