const processPath = require("dir-roll-up");
const dirNodeGenerator = processPath(".");
const interval = setInterval(async () => {
/**
* Get the next directory...
*/
const dirNode = await dirNodeGenerator.next();
/**
* ..display it..
*/
console.log(dirNode.value);
/**
* ..and end the interval when last directory retrieved (which will be the root)
*/
if (dirNode.done) {
console.log("Finished!");
clearInterval(interval);
}
}, 300);