diff options
Diffstat (limited to 'apps/files/src/services/WebdavClient.ts')
-rw-r--r-- | apps/files/src/services/WebdavClient.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files/src/services/WebdavClient.ts b/apps/files/src/services/WebdavClient.ts new file mode 100644 index 00000000000..2b92deba9b4 --- /dev/null +++ b/apps/files/src/services/WebdavClient.ts @@ -0,0 +1,19 @@ +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +import type { FileStat, ResponseDataDetailed } from 'webdav' +import type { Node } from '@nextcloud/files' + +import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav' + +export const client = getClient() + +export const fetchNode = async (path: string): Promise<Node> => { + const propfindPayload = getDefaultPropfind() + const result = await client.stat(`${getRootPath()}${path}`, { + details: true, + data: propfindPayload, + }) as ResponseDataDetailed<FileStat> + return resultToNode(result.data) +} |