get file name nodejs code example
Example 1: get file name nodejs
var path = require('path');
var scriptName = path.basename(__filename);
Example 2: how to get file name in directory node js
const path = require('path')
//...
//inside the `for` loop
const stat = fs.lstatSync(path.join(dir, file))