Node.js check if file exists

How do i check the existence of a file?

In the documentation for the module fs there’s a description of the method fs.exists(path, callback). But, as I understand, it checks for the existence of only directories. And I need to check the file!

How can this be done?

20 Answers
20

Leave a Comment