import { walk } from "https://deno.land/std@0.222.1/fs/mod.ts";
Recursively walks through a directory and yields information about each file and directory encountered.
Examples
Basic usage
Basic usage
File structure:
folder
├── script.ts
└── foo.ts
import { walk } from "https://deno.land/std@0.222.1/fs/walk.ts";
const entries = [];
for await (const entry of walk(".")) {
entries.push(entry);
}
entries[0]!.path; // "folder"
entries[0]!.name; // "folder"
entries[0]!.isFile; // false
entries[0]!.isDirectory; // true
entries[0]!.isSymlink; // false
entries[1]!.path; // "folder/script.ts"
entries[1]!.name; // "script.ts"
entries[1]!.isFile; // true
entries[1]!.isDirectory; // false
entries[1]!.isSymlink; // false
Parameters
root: string | URL
The root directory to start the walk from, as a string or URL.
optional
unnamed 1: WalkOptions = [UNSUPPORTED]The options for the walk.