Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
}
Source by flaviocopes.com #
 
PREVIOUS NEXT
Tagged: #file #directory #node #js
ADD COMMENT
Topic
Name
6+6 =