Skip to content

Commit f84e735

Browse files
authored
docs(fs): clarify permissions requirements for exists[Sync]() (denoland#5983)
* docs(fs): clarify permissions requirements for `exists[Sync]()` * work
1 parent 381d70d commit f84e735

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

fs/exists.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export interface ExistsOptions {
3636
* @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
3737
* more information on the time-of-check to time-of-use bug.
3838
*
39-
* Requires `--allow-read` and `--allow-sys` permissions.
39+
* Requires `--allow-read` permissions, and in some cases, `--allow-sys`
40+
* permissions if `options.isReadable` is `true`.
4041
*
4142
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
4243
* for more information on Deno's permissions system.
@@ -72,6 +73,9 @@ export interface ExistsOptions {
7273
* ```
7374
*
7475
* @example Check if a path is readable
76+
*
77+
* Requires `--allow-sys` permissions in some cases.
78+
*
7579
* ```ts no-eval
7680
* import { exists } from "@std/fs/exists";
7781
*
@@ -96,6 +100,9 @@ export interface ExistsOptions {
96100
* ```
97101
*
98102
* @example Check if a path is a readable directory
103+
*
104+
* Requires `--allow-sys` permissions in some cases.
105+
*
99106
* ```ts no-eval
100107
* import { exists } from "@std/fs/exists";
101108
*
@@ -104,6 +111,9 @@ export interface ExistsOptions {
104111
* ```
105112
*
106113
* @example Check if a path is a readable file
114+
*
115+
* Requires `--allow-sys` permissions in some cases.
116+
*
107117
* ```ts no-eval
108118
* import { exists } from "@std/fs/exists";
109119
*
@@ -166,7 +176,8 @@ export async function exists(
166176
* @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
167177
* more information on the time-of-check to time-of-use bug.
168178
*
169-
* Requires `--allow-read` and `--allow-sys` permissions.
179+
* Requires `--allow-read` permissions, and in some cases, `--allow-sys`
180+
* permissions if `options.isReadable` is `true`.
170181
*
171182
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
172183
* for more information on Deno's permissions system.
@@ -201,6 +212,9 @@ export async function exists(
201212
* ```
202213
*
203214
* @example Check if a path is readable
215+
*
216+
* Requires `--allow-sys` permissions in some cases.
217+
*
204218
* ```ts no-eval
205219
* import { existsSync } from "@std/fs/exists";
206220
*
@@ -225,6 +239,9 @@ export async function exists(
225239
* ```
226240
*
227241
* @example Check if a path is a readable directory
242+
*
243+
* Requires `--allow-sys` permissions in some cases.
244+
*
228245
* ```ts no-eval
229246
* import { existsSync } from "@std/fs/exists";
230247
*
@@ -233,6 +250,9 @@ export async function exists(
233250
* ```
234251
*
235252
* @example Check if a path is a readable file
253+
*
254+
* Requires `--allow-sys` permissions in some cases.
255+
*
236256
* ```ts no-eval
237257
* import { existsSync } from "@std/fs/exists";
238258
*

0 commit comments

Comments
 (0)