MCPcopy Index your code
hub / github.com/codedogQBY/ReadAny / safeReadDir

Method safeReadDir

packages/core/src/sync/webdav-client.ts:682–694  ·  view source on GitHub ↗

Safely list directory, create if not exists

(path: string)

Source from the content-addressed store, hash-verified

680
681 /** Safely list directory, create if not exists */
682 async safeReadDir(path: string): Promise<DavResource[]> {
683 const collectionPath = toCollectionPath(path);
684 try {
685 return await this.propfind(collectionPath);
686 } catch (e: unknown) {
687 const err = e as { message?: string };
688 if (err.message?.includes("404")) {
689 await this.ensureDirectory(collectionPath);
690 return [];
691 }
692 throw e;
693 }
694 }
695}
696
697/**

Callers 2

listDirMethod · 0.80

Calls 3

propfindMethod · 0.95
ensureDirectoryMethod · 0.95
toCollectionPathFunction · 0.85

Tested by

no test coverage detected