diff options
Diffstat (limited to 'ext/node/polyfills/_fs/_fs_exists.ts')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_exists.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/node/polyfills/_fs/_fs_exists.ts b/ext/node/polyfills/_fs/_fs_exists.ts index 9c8458b58..db41aedec 100644 --- a/ext/node/polyfills/_fs/_fs_exists.ts +++ b/ext/node/polyfills/_fs/_fs_exists.ts @@ -2,7 +2,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials - +const core = globalThis.__bootstrap.core; import { pathFromURL } from "ext:deno_web/00_infra.js"; type ExistsCallback = (exists: boolean) => void; @@ -35,10 +35,5 @@ Object.defineProperty(exists, kCustomPromisifiedSymbol, { */ export function existsSync(path: string | URL): boolean { path = path instanceof URL ? pathFromURL(path) : path; - try { - Deno.lstatSync(path); - return true; - } catch (_err) { - return false; - } + return core.ops.op_node_fs_exists_sync(path); } |