walkDirectory
Walks a directory recursively.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E, type ExpectType, G } from "@duplojs/utils";
const result = await SF.walkDirectory("/tmp/project");
// result: E.Success<Generator<...>> | SF.FileSystemLeft
const process = E.rightAsyncPipe(
"/tmp/other",
SF.walkDirectory,
G.map(
(value) => {
type check = ExpectType<
typeof value,
SF.FileInterface | SF.FolderInterface | SF.UnknownInterface,
"strict"
>;
return value;
},
),
);Syntax
typescript
function walkDirectory(
path: string | URL
): Promise<FileSystemLeft | E.Success<Generator<FileInterface | FolderInterface | UnknownInterface>>>Parameters
path: path of the directory to walk.
Return value
E.Success<Generator<...>>: generator of file, directory, or unknown interfaces.FileSystemLeft: if the read fails.
See also
readDirectory- Lists the entries in a directory.
