grab value from fs.readdir code example
Example 1: how to get file name in directory node js
const fs = require('fs')
const dir = '/Users/flavio/folder'
const files = fs.readdirSync(dir)
for (const file of files) {
console.log(file)
}
Example 2: nodejs readdir
const fs = require("fs")
fs.readdir("./myfolder", (err, data) => {
if(err) throw err
console.log(data)
})