Lesson 7 of 30
Built-in Modules
23% complete
Chapters
Chapter 7
Built-in Modules
Learn about modules that are included with Node.js.
Theory
Node.js provides many built-in modules that can be used without installing external packages.
Examples include:
• fs
• path
• os
• http
• events
• url
• crypto
These modules provide functionality for files, operating system information, networking, events, URLs, and security-related operations.
Example
Node.js Example
const os = require("os");
console.log("Platform:", os.platform());
console.log("Architecture:", os.arch());Output
The operating system platform and CPU architecture are displayed.
Practice
Explore three different Node.js built-in modules and test one function from each.
Interview Questions
1.
What are Node.js built-in modules?
2.
Give examples of built-in modules.
3.
Do built-in modules need to be installed separately?
Quick Quiz
Which option best matches this chapter?
A.Modules included with Node.js
B.Only modules downloaded from GitHub
C.Browser-only libraries
D.Database tables
Answer: Modules included with Node.js