node fs readdir code example
Example 1: nodejs readdir
const fs = require("fs")
fs.readdir("./myfolder", (err, data) => {
if(err) throw err
console.log(data)
})
Example 2: fs readfile encoding
fs.readFile('/etc/passwd', 'utf8', callback);
const fs = require("fs")
fs.readdir("./myfolder", (err, data) => {
if(err) throw err
console.log(data)
})
fs.readFile('/etc/passwd', 'utf8', callback);