Lets examine the following two examples for reading a file's contents:
The first one, which uses an async method for reading a file, and providing a callback function which is called once the file is fully read into the memory:
fs.readFile(`${__dirname}/utils.js`, (err, data) => {
if (err) {...