Function expandGlobSync
- expand
Glob (glob, options?): IterableIterator<WalkEntry>Sync Parameters
- glob: string | URL
The glob pattern to expand.
Optionaloptions: ExpandGlobOptionsAdditional options for the expansion.
Returns IterableIterator<WalkEntry>
An iterator that yields each walk entry matching the glob pattern.
See
https://docs.deno.com/runtime/manual/basics/permissions#file-system-access for more information on Deno's permissions system.
Example: Usage
File structure:
folder
├── script.ts
└── foo.ts// script.ts
import { expandGlobSync } from "@std/fs/expand-glob";
const entries = [];
for (const entry of expandGlobSync("*.ts")) {
entries.push(entry);
}
entries[0]!.path; // "/Users/user/folder/script.ts"
entries[0]!.name; // "script.ts"
entries[0]!.isFile; // false
entries[0]!.isDirectory; // true
entries[0]!.isSymlink; // false
entries[1]!.path; // "/Users/user/folder/foo.ts"
entries[1]!.name; // "foo.ts"
entries[1]!.isFile; // true
entries[1]!.isDirectory; // false
entries[1]!.isSymlink; // false- glob: string | URL
Returns an iterator that yields each file path matching the given glob pattern. The file paths are relative to the provided
rootdirectory. Ifrootis not provided, the current working directory is used. Therootdirectory is not included in the yielded file paths.Requires the
--allow-readflag.