diff --git a/.editorconfig b/.editorconfig index 9bdfbe6f..2c3848e0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ end_of_line = lf insert_final_newline = true -[*.{js,json}] +[*.{js,json,ts}] indent_style = space indent_size = 4 diff --git a/source/operations/getFileContents.ts b/source/operations/getFileContents.ts index 4373f784..dc9b7042 100644 --- a/source/operations/getFileContents.ts +++ b/source/operations/getFileContents.ts @@ -15,6 +15,30 @@ import { const TRANSFORM_RETAIN_FORMAT = (v: any) => v; +type GetFileContentsBasicOptions = Omit; + +export async function getFileContents( + context: WebDAVClientContext, + filePath: string, + options?: GetFileContentsBasicOptions & { format?: "binary"; details?: false } +): Promise; +export async function getFileContents( + context: WebDAVClientContext, + filePath: string, + options: GetFileContentsBasicOptions & { format: "text"; details?: false } +): Promise; +// details +export async function getFileContents( + context: WebDAVClientContext, + filePath: string, + options: GetFileContentsBasicOptions & { format?: "binary"; details: true } +): Promise>; +export async function getFileContents( + context: WebDAVClientContext, + filePath: string, + options: GetFileContentsBasicOptions & { format: "text"; details: true } +): Promise>; + export async function getFileContents( context: WebDAVClientContext, filePath: string,