Built-In Module
noun
say it: “BILT-in MOJ-ool” /ˈbɪltˌɪn ˈmɑdʒul/
A module that ships with Node, such as fs or path, ready to import with nothing to download.
What is a built-in module in Node?
A built-in module comes with Node itself, so there's nothing to install. You import it by name with node: in front, such as node:fs/promises for files or node:path for file paths.
import { readFile } from "node:fs/promises";
import path from "node:path";
const file = path.join("data", "orders.json");
console.log(await readFile(file, "utf8"));
In a sentence
- “Reading the orders file needed no npm install, because fs is a built-in module.”
- “Writing node:path makes it clear that path is a built-in module and not a package from npm.”
Level: Apprentice · More Node.js terms at this level
Updated