Synchronous version of exists. Checks whether a file or directory exists at the specified path.
exists
The absolute path to check.
Optional
Optional existence options (e.g., isDirectory, isFile).
An IOResult containing true if exists, false otherwise.
IOResult
true
false
exists for the async version.
1.1.0
existsSync('/path/to/file') .inspect(exists => exists && console.log('File exists')); Copy
existsSync('/path/to/file') .inspect(exists => exists && console.log('File exists'));
Synchronous version of
exists. Checks whether a file or directory exists at the specified path.