How can I synchronously check, using node.js, if a file or directory exists?
Looking at the source, there's a synchronous version of path.exists
- path.existsSync
. Looks like it got missed in the docs.
path.exists
and path.existsSync
are now deprecated. Please use .fs.exists
and fs.existsSync
fs.exists
and been deprecated. Use fs.stat() or fs.access() instead.fs.existsSync
have also
use fs.existsSync
. It's not deprecated.
https://nodejs.org/api/fs.html#fs_fs_existssync_path