Skip to content

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

Open
@dsissitka

Description

@dsissitka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions