How to Use the Node.js File System Module

Using callback const fs = require('fs'); const path = './file.txt'; fs.access(path, (error, stats) => { if (error) { console.error(error); } else { console.log(stats); } }); Using util.promisifyNode v8.0.0 added support for a built-in util.promisify. const fs =…