Answers for "nodejs get current file directory"

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
0

node get path of current file

module.filename
Posted by: Guest on February-22-2021

Code answers related to "nodejs get current file directory"

Code answers related to "Javascript"

Browse Popular Code Answers by Language