Node.js uses error-first callbacks. The first parameter is an error (or null if success). The second is the result.
readFile("data.txt", (err, data) => {
if (err) {
console.error("Failed:", err);
return;
}
console.log(data);
});
Always check the error parameter first before using the result.