walkDirectory
Parcourt un dossier récursivement.
Exemple
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;
},
),
);Syntaxe
typescript
function walkDirectory(
path: string | URL
): Promise<FileSystemLeft | E.Success<Generator<FileInterface | FolderInterface | UnknownInterface>>>Paramètres
path: chemin du dossier a parcourir.
Valeur de retour
E.Success<Generator<...>>: generateur d'interfaces fichier, dossier ou inconnu.FileSystemLeft: si la lecture échoue.
Voir aussi
readDirectory- Liste les entrées d'un dossier.
