Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a506ac

Browse filesBrowse files
mcollinaaduh95
authored andcommitted
fs: add followSymlinks option to glob
PR-URL: #62695 Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent dafed45 commit 4a506ac
Copy full SHA for 4a506ac

3 files changed

+308-28Lines changed: 308 additions & 28 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+24Lines changed: 24 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,9 @@ behavior is similar to `cp dir1/ dir2/`.
10881088
<!-- YAML
10891089
added: v22.0.0
10901090
changes:
1091+
- version: REPLACEME
1092+
pr-url: https://github.com/nodejs/node/pull/62695
1093+
description: Add support for the `followSymlinks` option.
10911094
- version: v24.1.0
10921095
pr-url: https://github.com/nodejs/node/pull/58182
10931096
description: Add support for `URL` instances for `cwd` option.
@@ -1113,11 +1116,16 @@ changes:
11131116
If a string array is provided, each string should be a glob pattern that
11141117
specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
11151118
not supported.
1119+
* `followSymlinks` {boolean} When `true`, symbolic links to directories are
1120+
followed while expanding `**` patterns. **Default:** `false`.
11161121
* `withFileTypes` {boolean} `true` if the glob should return paths as Dirents,
11171122
`false` otherwise. **Default:** `false`.
11181123
* Returns: {AsyncIterator} An AsyncIterator that yields the paths of files
11191124
that match the pattern.
11201125
1126+
When `followSymlinks` is enabled, detected symbolic link cycles are not
1127+
traversed recursively.
1128+
11211129
```mjs
11221130
import { glob } from 'node:fs/promises';
11231131

@@ -3194,6 +3202,9 @@ descriptor. See [`fs.utimes()`][].
31943202
<!-- YAML
31953203
added: v22.0.0
31963204
changes:
3205+
- version: REPLACEME
3206+
pr-url: https://github.com/nodejs/node/pull/62695
3207+
description: Add support for the `followSymlinks` option.
31973208
- version: v24.1.0
31983209
pr-url: https://github.com/nodejs/node/pull/58182
31993210
description: Add support for `URL` instances for `cwd` option.
@@ -3217,6 +3228,8 @@ changes:
32173228
* `exclude` {Function|string\[]} Function to filter out files/directories or a
32183229
list of glob patterns to be excluded. If a function is provided, return
32193230
`true` to exclude the item, `false` to include it. **Default:** `undefined`.
3231+
* `followSymlinks` {boolean} When `true`, symbolic links to directories are
3232+
followed while expanding `**` patterns. **Default:** `false`.
32203233
* `withFileTypes` {boolean} `true` if the glob should return paths as Dirents,
32213234
`false` otherwise. **Default:** `false`.
32223235
@@ -3225,6 +3238,9 @@ changes:
32253238
32263239
* Retrieves the files matching the specified pattern.
32273240
3241+
When `followSymlinks` is enabled, detected symbolic link cycles are not
3242+
traversed recursively.
3243+
32283244
```mjs
32293245
import { glob } from 'node:fs';
32303246
@@ -5763,6 +5779,9 @@ Synchronous version of [`fs.futimes()`][]. Returns `undefined`.
57635779
<!-- YAML
57645780
added: v22.0.0
57655781
changes:
5782+
- version: REPLACEME
5783+
pr-url: https://github.com/nodejs/node/pull/62695
5784+
description: Add support for the `followSymlinks` option.
57665785
- version: v24.1.0
57675786
pr-url: https://github.com/nodejs/node/pull/58182
57685787
description: Add support for `URL` instances for `cwd` option.
@@ -5785,10 +5804,15 @@ changes:
57855804
* `exclude` {Function|string\[]} Function to filter out files/directories or a
57865805
list of glob patterns to be excluded. If a function is provided, return
57875806
`true` to exclude the item, `false` to include it. **Default:** `undefined`.
5807+
* `followSymlinks` {boolean} When `true`, symbolic links to directories are
5808+
followed while expanding `**` patterns. **Default:** `false`.
57885809
* `withFileTypes` {boolean} `true` if the glob should return paths as Dirents,
57895810
`false` otherwise. **Default:** `false`.
57905811
* Returns: {string\[]} paths of files that match the pattern.
57915812
5813+
When `followSymlinks` is enabled, detected symbolic link cycles are not
5814+
traversed recursively.
5815+
57925816
```mjs
57935817
import { globSync } from 'node:fs';
57945818

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.