Answer the question
In order to leave comments, you need to log in
How to check if a folder exists?
How to use fs to check if a folder exists or not?
Answer the question
In order to leave comments, you need to log in
var fs = require('fs');
fs.stat('path/to/dir', function(err) {
if (!err) {
console.log('Директория есть');
}
else if (err.code === 'ENOENT') {
console.log('директории нет');
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question