1 line
1.3 KiB
Plaintext
1 line
1.3 KiB
Plaintext
{"version":3,"file":"fileFetcher-EOUUgMjG.chunk.mjs","sources":["../src/services/fileFetcher.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { AxiosError } from 'axios'\nimport type { FileStat, ResponseDataDetailed, StatOptions } from 'webdav'\n\nimport { resultToNode } from '@nextcloud/files/dav'\nimport { davClient } from './DavClient.ts'\nimport { getPropFind } from './DavRequest.ts'\n\n/**\n *\n * @param fileName\n * @param options\n */\nexport async function fetchFile(fileName: string, options: StatOptions = {}) {\n\ttry {\n\t\tconst response = await davClient.stat(fileName, {\n\t\t\tdata: getPropFind(),\n\t\t\tdetails: true,\n\t\t\t...options,\n\t\t}) as ResponseDataDetailed<FileStat>\n\n\t\treturn resultToNode(response.data)\n\t} catch (error) {\n\t\tif ((error as AxiosError).code === 'ERR_CANCELED') {\n\t\t\treturn null\n\t\t}\n\n\t\tthrow error\n\t}\n}\n"],"names":["fetchFile","fileName","options","response","davClient","getPropFind","resultToNode","error"],"mappings":"iHAiBA,eAAsBA,EAAUC,EAAkBC,EAAuB,GAAI,CACxE,GAAA,CACH,MAAMC,EAAW,MAAMC,EAAU,KAAKH,EAAU,CAC/C,KAAMI,EAAY,EAClB,QAAS,GACT,GAAGH,CAAA,CACH,EAEM,OAAAI,EAAaH,EAAS,IAAI,QACzBI,EAAO,CACV,GAAAA,EAAqB,OAAS,eAC3B,OAAA,KAGF,MAAAA,CAAA,CAER"} |