From fb41d0837ab06285cc70a9e63ca5d050c7ae836e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 12 Feb 2019 22:11:50 +0900 Subject: [PATCH] [fs-extra] add copyFile() support --- types/fs-extra/fs-extra-tests.ts | 4 ++++ types/fs-extra/index.d.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index dbe48cf971..9eab816f63 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -214,3 +214,7 @@ fs.writeFile("foo.txt", "i am foo", { encoding: "utf-8" }); // $ExpectType Promise fs.mkdtemp("foo"); + +fs.copyFile("src", "dest").then(); +fs.copyFile("src", "dest", fs.constants.COPYFILE_EXCL).then(); +fs.copyFile("src", "dest", errorCallback); diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index c5eddbf416..c1b661daae 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -20,6 +20,10 @@ export function copy(src: string, dest: string, callback: (err: Error) => void): export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void; export function copySync(src: string, dest: string, options?: CopyOptionsSync): void; +export function copyFile(src: string, dest: string, flags?: number): Promise; +export function copyFile(src: string, dest: string, callback: (err: Error) => void): void; +export function copyFile(src: string, dest: string, flags: number, callback: (err: Error) => void): void; + export function move(src: string, dest: string, options?: MoveOptions): Promise; export function move(src: string, dest: string, callback: (err: Error) => void): void; export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void;