You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
453 B
TypeScript

import { getStat } from "./stat";
import { WebDAVClientContext, WebDAVMethodOptions } from "../types";
export async function exists(
context: WebDAVClientContext,
remotePath: string,
options: WebDAVMethodOptions = {}
): Promise<boolean> {
try {
await getStat(context, remotePath, options);
return true;
} catch (err) {
if (err.status === 404) {
return false;
}
throw err;
}
}