Answers for "node get name of all files in directory"

6

node get all files in folder

fs.readdir('./', (err, files) => {
    files.forEach(file => {
    //   console.log(file);
})});
Posted by: Guest on March-15-2021
3

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)
}
Posted by: Guest on October-16-2020

Code answers related to "node get name of all files in directory"

Code answers related to "Javascript"

Browse Popular Code Answers by Language