UseReadDir
katanakit-js / useReadDir
Function: useReadDir()
Section titled “Function: useReadDir()”function useReadDir(path, options?): Promise<FilesystemResult<{ isDirectory: boolean; isFile: boolean; name: string; path: string;}[]>>;Defined in: infrastructure/filesystem/filesystem.service.ts:327
Lists a directory with type flags resolved per entry.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path |
string |
Directory path. |
options? |
{ recursive?: boolean; } |
recursive: true walks nested directories. |
options.recursive? |
boolean |
- |
Returns
Section titled “Returns”Promise<FilesystemResult<{
isDirectory: boolean;
isFile: boolean;
name: string;
path: string;
}[]>>
Safe Result with { name, path, isFile, isDirectory } entries.
Example
Section titled “Example”const result = await useReadDir("content", { recursive: true });if (result.ok) result.data.filter((entry) => entry.isFile);