Lesson 17 / 30
Promises in Node
Use Promise-based built-in APIs and Promise.all to run async operations concurrently.
Native Promise APIs
Many built-ins now ship a Promise-based version directly — no wrapping needed.
import { readFile } from "node:fs/promises";
readFile("notes.txt", "utf8")
.then((data) => console.log(data))
.catch((err) => console.error("Failed:", err.message));Promise.all for parallel work
Promise.all runs several async operations concurrently and waits for all of them to finish.