NodeJS Check Directory istnieje lub nie
var fs = require('fs');
if (!fs.existsSync(newDest)) fs.mkdirSync(newDest,'0777', true);
Jaimin Patel
var fs = require('fs');
if (!fs.existsSync(newDest)) fs.mkdirSync(newDest,'0777', true);
const fs = require("fs")
fs.access("./directory-name", function(error) {
if (error) {
console.log("Directory does not exist.")
} else {
console.log("Directory exists.")
}
})