//requiring path and fs modulesconst path = require('path');const fs = require('fs');//joining path of directoryconst directoryPath = path.join(__dirname, 'Documents');//passsing directoryPath and callback functionfs.readdir(directoryPath, function (err, files) { //handling error if (err) { return console.log('Unable to scan directory: ' + err); } //listing all files using forEach files.forEach(function (file) { // Do whatever you want to do with the file console.log(file); });});