List all files in a directory using Node.js recursively in a synchronous fashion

The following program can be used to List all files in a directory using Node.js recursively in a synchronous fashion.

you can call the function walkSync by passing the folderPath which is to be iterated as an argument


it is important to add a / after the folder name.

 

Reference: https://gist.github.com/kethinov/6658166