denoland / denoland/std

@std/fs/exists returns true when a path is inaccessible.

Open
#6,528 2 comments 0 reactions 0 assignees View on GitHub
bug needs triage
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

@std/fs/exists returns true when a path is inaccessible.

**Steps to Reproduce**

```
$ ls /root
ls: cannot open directory '/root': Permission denied
$ cat test.ts
import { exists } from "jsr:@std/fs@^1.0.15";

console.log(await exists("/root/foo"))
$ deno run --allow-read test.ts
true
$
```

**Expected behavior**

Throw an error. Maybe a `Deno.errors.PermissionDenied` like `Deno.readDir("/root")`?

**Environment**

- OS: Fedora 41
- deno version: 2.2.6
- std version: 1.0.15

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.