Skip to content

Commit 0559b0e

Browse files
jedwards1211isaacs
authored andcommitted
docs: add better links to path-scurry docs
PR-URL: #609 Credit: @jedwards1211 Close: #609 Reviewed-by: @isaacs
1 parent c9773c2 commit 0559b0e

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

README.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The most correct and second fastest glob implementation in
66
JavaScript. (See **Comparison to Other JavaScript Glob
77
Implementations** at the bottom of this readme.)
88

9-
![a fun cartoon logo made of glob characters](https://github.com/isaacs/node-glob/raw/main/logo/glob.png)
9+
![a fun cartoon logo made of glob
10+
characters](https://github.com/isaacs/node-glob/raw/main/logo/glob.png)
1011

1112
## Usage
1213

@@ -69,8 +70,9 @@ for (const file of g2) {
6970
}
7071

7172
// you can also pass withFileTypes: true to get Path objects
72-
// these are like a Dirent, but with some more added powers
73-
// check out http://npm.im/path-scurry for more info on their API
73+
// these are like a fs.Dirent, but with some more added powers
74+
// check out https://isaacs.github.io/path-scurry/classes/PathBase.html
75+
// for more info on their API
7476
const g3 = new Glob('**/baz/**', { withFileTypes: true })
7577
g3.stream().on('data', path => {
7678
console.log(
@@ -88,9 +90,8 @@ g3.stream().on('data', path => {
8890
// For example:
8991
const results = await glob('**', { stat: true, withFileTypes: true })
9092

91-
const timeSortedFiles = results
92-
.sort((a, b) => a.mtimeMs - b.mtimeMs)
93-
.map(path => path.fullpath())
93+
const timeSortedFiles = results .sort((a, b) => a.mtimeMs -
94+
b.mtimeMs) .map(path => path.fullpath())
9495

9596
const groupReadableFiles = results
9697
.filter(path => path.mode & 0o040)
@@ -534,6 +535,16 @@ share the previously loaded cache.
534535
called to determine whether any Path is a match or if its
535536
children should be traversed, respectively.
536537

538+
The `path` argument to the methods will be a
539+
[`path-scurry`](https://isaacs.github.io/path-scurry/index.html)
540+
[`Path`](https://isaacs.github.io/path-scurry/classes/PathBase)
541+
object, which extends
542+
[`fs.Dirent`](https://nodejs.org/docs/latest/api/fs.html#class-fsdirent)
543+
with additional useful methods like
544+
[`.fullpath()`](https://isaacs.github.io/path-scurry/classes/PathBase.html#fullpath),
545+
[`.relative()`](https://isaacs.github.io/path-scurry/classes/PathBase.html#relative),
546+
and more.
547+
537548
- `follow` Follow symlinked directories when expanding `**`
538549
patterns. This can result in a lot of duplicate references in
539550
the presence of cyclic links, and make performance quite bad.
@@ -574,24 +585,27 @@ share the previously loaded cache.
574585
available, or `'linux'` if not. Setting `platform:'win32'` on
575586
non-Windows systems may cause strange behavior.
576587

577-
- `withFileTypes` Return [PathScurry](http://npm.im/path-scurry)
578-
`Path` objects instead of strings. These are similar to a
579-
NodeJS `Dirent` object, but with additional methods and
580-
properties.
588+
- `withFileTypes` Return
589+
[`path-scurry`](http://npm.im/path-scurry)
590+
[`Path`](https://isaacs.github.io/path-scurry/classes/PathBase.html)
591+
objects instead of strings. These are similar to a NodeJS
592+
`fs.Dirent` object, but with additional methods and properties.
581593

582594
`withFileTypes` may not be used along with `absolute`.
583595

584596
- `signal` An AbortSignal which will cancel the Glob walk when
585597
triggered.
586598

587599
- `fs` An override object to pass in custom filesystem methods.
588-
See [PathScurry docs](http://npm.im/path-scurry) for what can
589-
be overridden.
590-
591-
- `scurry` A [PathScurry](http://npm.im/path-scurry) object used
592-
to traverse the file system. If the `nocase` option is set
593-
explicitly, then any provided `scurry` object must match this
594-
setting.
600+
See [`path-scurry`
601+
docs](https://isaacs.github.io/path-scurry/interfaces/FSOption.html)
602+
for what can be overridden.
603+
604+
- `scurry` A
605+
[`PathScurry`](https://isaacs.github.io/path-scurry/classes/PathScurryBase.html)
606+
object used to traverse the file system. If the `nocase` option
607+
is set explicitly, then any provided `scurry` object must match
608+
this setting.
595609

596610
- `includeChildMatches` boolean, default `true`. Do not match any
597611
children of any matches. For example, the pattern `**\/foo`

0 commit comments

Comments
 (0)