mirror of https://github.com/veypi/OneAuth.git
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.
27 lines
856 B
TypeScript
27 lines
856 B
TypeScript
import { joinURL } from "../tools/url";
|
|
import { encodePath } from "../tools/path";
|
|
import { request, prepareRequestOptions } from "../request";
|
|
import { handleResponseCode } from "../response";
|
|
import { WebDAVClientContext, WebDAVMethodOptions } from "../types";
|
|
|
|
export async function copyFile(
|
|
context: WebDAVClientContext,
|
|
filename: string,
|
|
destination: string,
|
|
options: WebDAVMethodOptions = {}
|
|
): Promise<void> {
|
|
const requestOptions = prepareRequestOptions(
|
|
{
|
|
url: joinURL(context.remoteURL, encodePath(filename)),
|
|
method: "COPY",
|
|
headers: {
|
|
Destination: joinURL(context.remoteURL, encodePath(destination))
|
|
}
|
|
},
|
|
context,
|
|
options
|
|
);
|
|
const response = await request(requestOptions);
|
|
handleResponseCode(context, response);
|
|
}
|