Djboboch
Djboboch

Reputation: 45

Perform directory check in Node.js

I am looking for a way to run a server script that will check that all the required directories are present in the server directory.

I have looked into server.on('event') however, there seems that such event does not exist.

Upvotes: 0

Views: 139

Answers (1)

SimpleJ
SimpleJ

Reputation: 14768

You can use Node's fs.stat function to check if a file exists and stats.isDirectory() to check if it's a directory.

Upvotes: 1

Related Questions