await fs.mkdir(path.join(__dirname, "/smartsheet_download"),
{ recursive: true }, (err) => {
if (err) {
return console.error(err);
}
__dirname= path.join(__dirname, "/smartsheet_download");
console.log("after func:" + __dirname);
})
console.log("this must be printed after path at last")
}
my question in this above function is i am printing "this must be printed after path at last" after the fs.mkdir operation but when i am running the code it prints first. i am using async and await so that it must wait for fs.mkdir to complete the execution before printing the last line. Still this thing does not work. Could u please tell how can i wait for fs.mkdir to complete and then pass the execution to next line. moreover, please tell why await do not work here?