Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs: makes existsSync stop using errors
The previous implementation of `existsSync` was a try/catch on top of `accessSync`. While conceptually sound it was a performance problem when running it repeatedly on non-existing files, because `accessSync` had to create an `Error` object that was immediatly discarded (because `existsSync` never reports anything else than `true` / `false`). This implementation simply checks whether the context would have caused an exception to be thrown, but doesn't actually create it. Fixes: nodejs#24008
- Loading branch information