views:

175

answers:

1

I can't find where in the documentation I can get all filenames in a directory

Thanks for any help!

+4  A: 

You can use the fs.readdir or fs.readdirSync methods.

The difference between the two methods, is that the first one is asynchronous, so you have to provide a callback function that will be executed when the read process ends.

The second is synchronous, it will returns the file name array, but it will stop any further execution of your code until the read process ends.

CMS