Filesystem Basics
The fs module reads and writes files. Prefer promise-based fs.promises in new code. In Write tasks we simulate with plain strings.
- readFile / writeFile are common.
- Always handle errors.
- Never trust user paths blindly (path traversal).
const text = "file-ok";
console.log(text);
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.