Answers for "Current folder of a file nodejs"

5

node js get files in dir

const path = require('path');
const fs = require('fs');

fs.readdir(
  path.resolve(__dirname, 'MyFolder'),
  (err, files) => {
    if (err) throw err;
    
    for (let file of files) {
      console.log(file);
    }
  }
);
Posted by: Guest on September-07-2020

Code answers related to "Current folder of a file nodejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language