| hide_title | true |
|---|---|
| custom_edit_url | |
| pagination_prev | |
| pagination_next |
Home > @rushstack/node-core-library > FileSystem > exists
Returns true if the path exists on disk. Behind the scenes it uses fs.existsSync()<></>.
Signature:
static exists(path: string): boolean;|
Parameter |
Type |
Description |
|---|---|---|
|
path |
string |
The absolute or relative path to the filesystem object. |
Returns:
boolean
There is a debate about the fact that after fs.existsSync() returns true, the file might be deleted before fs.readSync() is called, which would imply that everybody should catch a readSync() exception, and nobody should ever use fs.existsSync()<></>. We find this to be unpersuasive, since "unexceptional exceptions" really hinder the break-on-exception debugging experience. Also, throwing/catching is generally slow.