Search
 
SCRIPT & CODE EXAMPLE
 

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)
}
Comment

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);
    }
  }
);
Comment

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))
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery if else on click 
Javascript :: addeventlistener input 
Javascript :: jquery get select option attribute 
Javascript :: speed facebook video 
Javascript :: SyntaxError: Cannot use import statement outside a module node js 
Javascript :: js arrays check if there is intersection 
Javascript :: create array initialize size javascript 
Javascript :: ng serve without reload 
Javascript :: jquery get all file input elements 
Javascript :: check all after click first checkbox jquery 
Javascript :: quicksettins.js 
Javascript :: do more than one thing at start of or loop javascript 
Javascript :: how to do regex email validation with domain 
Javascript :: update node mac 
Javascript :: node js try catch 
Javascript :: js get random data between two dates 
Javascript :: how to get id from url in javascript 
Javascript :: javascript try catch finally 
Javascript :: tomodachi 
Javascript :: refresh page js 
Javascript :: i18n turn off suspense react 
Javascript :: javascript leap year 
Javascript :: newtonsoft json object to json string 
Javascript :: how to make a kill command discord.js 
Javascript :: generate random date in a range 
Javascript :: javaScript getSeconds() Method 
Javascript :: getelementbytagname javascript 
Javascript :: popup alert in flutter 
Javascript :: create new angular component command 
Javascript :: create react app with tailwind 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =