Skip to content

UseFileExists

katanakit-js / 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.

Parameter Type Description
path string Path to check.

Promise<boolean>

true when the path exists.

if (await useFileExists("data/books.json")) {
// read it
}