import { walk } from "https://deno.land/x/pastedeno@0.6.2/dev_deps.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.224.0/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.