MCPcopy Create free account
hub / github.com/codedogQBY/ReadAny / propfind

Method propfind

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

List directory contents (PROPFIND Depth 1)

(path: string)

Source from the content-addressed store, hash-verified

663
664 /** List directory contents (PROPFIND Depth 1) */
665 async propfind(path: string): Promise<DavResource[]> {
666 const resp = await this.request("PROPFIND", path, {
667 headers: { Depth: "1" },
668 body: '<?xml version="1.0"?><D:propfind xmlns:D="DAV:"><D:prop><D:resourcetype/><D:getcontentlength/><D:getlastmodified/><D:getetag/></D:prop></D:propfind>',
669 contentType: "application/xml",
670 });
671 if (!resp.ok && resp.status !== 207) {
672 if (resp.status === 404 || resp.status === 409) return [];
673 throw new Error(
674 `WebDAV PROPFIND failed for ${path}: ${resp.status} ${resp.statusText || ""}`,
675 );
676 }
677 const xml = await resp.text();
678 return parsePropfindResponse(xml, path, this.buildUrl(path));
679 }
680
681 /** Safely list directory, create if not exists */
682 async safeReadDir(path: string): Promise<DavResource[]> {

Callers 4

safeReadDirMethod · 0.95
testConnectionMethod · 0.80
listMethod · 0.80

Calls 3

requestMethod · 0.95
buildUrlMethod · 0.95
parsePropfindResponseFunction · 0.85

Tested by

no test coverage detected