Skip to content

Commit

Permalink
Merge pull request #309 from magicdawn/feat-get-filecontents-overload
Browse files Browse the repository at this point in the history
feat: add ts overload to getFileContents
  • Loading branch information
perry-mitchell committed Aug 21, 2022
2 parents 0cd3c8a + 45d1661 commit 1703129
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
end_of_line = lf
insert_final_newline = true

[*.{js,json}]
[*.{js,json,ts}]
indent_style = space
indent_size = 4

Expand Down
24 changes: 24 additions & 0 deletions source/operations/getFileContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ import {

const TRANSFORM_RETAIN_FORMAT = (v: any) => v;

type GetFileContentsBasicOptions = Omit<GetFileContentsOptions, "format" | "details">;

export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
options?: GetFileContentsBasicOptions & { format?: "binary"; details?: false }
): Promise<BufferLike>;
export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
options: GetFileContentsBasicOptions & { format: "text"; details?: false }
): Promise<string>;
// details
export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
options: GetFileContentsBasicOptions & { format?: "binary"; details: true }
): Promise<ResponseDataDetailed<BufferLike>>;
export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
options: GetFileContentsBasicOptions & { format: "text"; details: true }
): Promise<ResponseDataDetailed<string>>;

export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
Expand Down

0 comments on commit 1703129

Please sign in to comment.