UseFileExists
katanakit-js / useFileExists
Function: useFileExists()
Section titled “Function: useFileExists()”function useFileExists(path): Promise<boolean>;Defined in: infrastructure/filesystem/filesystem.service.ts:379
Checks whether a path exists and is accessible.
Never throws: returns false for missing paths and non-Node runtimes.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path |
string |
Path to check. |
Returns
Section titled “Returns”Promise<boolean>
true when the path exists.
Example
Section titled “Example”if (await useFileExists("data/books.json")) { // read it}