* Synchronously tests whether or not the given path exists. * @param {string | Buffer | URL} path * @returns {boolean}
(path)
| 316 | * @returns {boolean} |
| 317 | */ |
| 318 | function existsSync(path) { |
| 319 | const h = vfsState.handlers; |
| 320 | if (h !== null) { |
| 321 | const result = h.existsSync(path); |
| 322 | if (result !== undefined) return result; |
| 323 | } |
| 324 | try { |
| 325 | path = getValidatedPath(path); |
| 326 | } catch (err) { |
| 327 | if (showExistsDeprecation && err?.code === 'ERR_INVALID_ARG_TYPE') { |
| 328 | process.emitWarning( |
| 329 | 'Passing invalid argument types to fs.existsSync is deprecated', 'DeprecationWarning', 'DEP0187', |
| 330 | ); |
| 331 | showExistsDeprecation = false; |
| 332 | } |
| 333 | return false; |
| 334 | } |
| 335 | |
| 336 | return binding.existsSync(path); |
| 337 | } |
| 338 | |
| 339 | function readFileAfterOpen(err, fd) { |
| 340 | const context = this.context; |
no test coverage detected
searching dependent graphs…