import { walk } from "https://dotland.deno.dev/std@0.224.0/fs/walk.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