fs.exists() is both true and false

fs.exists() is both true and false

Problem

fs.exists(controller_path, function (exists) 
{
     util.debug( exists ? 'here' : 'not here' );
});

This is the example from the documentation. The file definitely exists but for each request, I recieve:

DEBUG: here
DEBUG: not here
Problem courtesy of: Nick Maroulis

Solution

You have posted sample code but not the actual code you have. Don’t expect much.

However, he’s a shot-in-the-dark that I’m willing to bet is right:

You don’t realize that the browser is sending 2 GET requests: 1 for “/” and a second for “/favicon.ico”.

Solution courtesy of: Peter Lyons

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *