The documentation for fs.rmdir is very short and doesn\'t explain the behavior of rmdir when the directory is not empty.
Q: What happens if I try to use
Removing NON-EMPTY directories SYNCHRONOUSLY:-
Following is the file structure -
var fs = require('fs');
fs.unlink('./stuff/writeMe.txt',function(){
fs.rmdirSync('stuff');
})
I am firstly removing the writeMe.txt file from stuff folder using code fs.unlink('./stuff/writeMe.txt')
which makes the stuff folder empty and finally removing it using code fs.rmdirSync('stuff')