Core Modules

Core modules are built into Node.js. You do not need to install them. They cover the most common backend tasks: reading files, making HTTP requests, working with paths, and more.

Main core modules

ModuleWhat it does
fsRead, write, and manage files and directories
pathParse and join file system paths across platforms
http / httpsCreate HTTP(S) servers and make requests
urlParse and work with URLs
osAccess operating system information (platform, CPU, memory)
eventsImplement event emitters (Node observer pattern)
streamWork with readable and writable data streams
querystringParse query string data
child_processSpawn external processes
cryptoEncrypt and hash data
utilUtility functions, including promisify for converting callbacks to promises
assertAssertion-based testing helpers
netLow-level networking (TCP/IPC)

Importing core modules

No installation needed. Import by name.

CommonJS:

const fs = require('fs');
const path = require('path');
const http = require('http');

ES modules:

import fs from 'fs';
import path from 'path';
import http from 'http';

Modern Node.js also supports the node: prefix. This is recommended in newer code because it makes it clear you are importing a built-in module rather than an npm package with the same name:

import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';

For more detail on each module, see the Node.js documentation .