Path.globSync() method
pathlib-ts > Path > globSync
Path.globSync() method
Section titled “Path.globSync() method”Performs a blocking glob search relative to this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
Signature:
globSync(pattern: string, options?: fs.GlobOptions): Path[];Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
pattern |
string |
Glob pattern interpreted relative to this path. |
|
options |
fs.GlobOptions |
(Optional) Options forwarded to Node’s |
Returns:
Path[]
Matching paths as Path objects.
Exceptions
Section titled “Exceptions”The UnsupportedOperation If fs.globSync is unavailable.
Remarks
Section titled “Remarks”Requires runtime support for fs.globSync; otherwise UnsupportedOperation is thrown.
Example
Section titled “Example”Gathering TypeScript sources synchronously
import { Path } from "pathlib-ts";
const repo = new Path("./src");const matches = repo.globSync("**.ts");console.log(matches.length);