Answers for "check if dir has file in javascript"

3

fs check if dir is dir

fs.lstatSync(path_string).isDirectory()
Posted by: Guest on June-05-2021
1

javascript folder exists

const fs = require('fs');

// directory to check if exists
const dir = './uploads';

// check if directory exists
fs.access(dir, (err) => {
    console.log(`Directory ${err ? 'does not exist' : 'exists'}`);
});
Posted by: Guest on December-08-2020

Code answers related to "check if dir has file in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language