Path.rglob() method
pathlib-ts > Path > rglob
Path.rglob() method
Section titled “Path.rglob() method”Asynchronously performs a recursive glob in this subtree, and yields all existing files (of any kind, including directories) matching the given relative pattern.
Signature:
rglob(pattern: string, options?: fs.GlobOptions): Promise<Path[]>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
pattern |
string |
Glob pattern to evaluate recursively. |
|
options |
fs.GlobOptions |
(Optional) Options forwarded to Node’s glob implementation. |
Returns:
Promise<Path[]>
Promise resolving to matching Path objects.
Exceptions
Section titled “Exceptions”The UnsupportedOperation If globbing is not supported by the runtime.
Remarks
Section titled “Remarks”Equivalent to prefixing the pattern with the recursive "**" segment and calling Path.glob(). fs.glob support.
Example
Section titled “Example”Recursively locating markdown pages
import { Path } from "pathlib-ts";
const content = new Path("./content");const docs = await content.rglob("**.mdx");console.log(docs.length);