Answers for "how to find a file with a certain name in node js"

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
1

get file name nodejs

var path = require('path');
var scriptName = path.basename(__filename);
Posted by: Guest on October-18-2020

Code answers related to "how to find a file with a certain name in node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language