How to determine is string represent a directory or a file in Node.js?

Possible Duplicate:
Check synchronously if file/directory exists in Node.js

For example, i have a string "C:/dev/image.folder", and i want to determine, is it directory or a file (synchronously). How can i do it?

Thanks in advance!

// Query the entry
stats = fs.lstatSync('/the/path');

// Is it a directory?
if (stats.isDirectory()) {
    // Yes it is
}

See T.J. Crowder's answer here: Check synchronously if file/directory exists in Node.js