I am trying to create the directory in public/data folder to place my read data but Getting this error while creating the directory dynamically in nodejs
.
Error: ENOENT: no such file or directory, mkdir './public/data/folder'
at Object.mkdirSync (fs.js:753:3)
at /home/ubuntu/New/routes/index.js:589:14
at FSReqWrap.oncomplete (fs.js:141:20)
I have implemented my code like this by checking the folder exist or not and creating the folder when not exist using mkdirsync()
var dd = './public/data/'+ id;
if (!fs.existsSync(dd))
{
fs.mkdirSync(dd,'0777', true);
console.log("Directory Created!!");
}
Directory Created!!