diff options
Diffstat (limited to 'std/node/_fs/_fs_copy.ts')
-rw-r--r-- | std/node/_fs/_fs_copy.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/std/node/_fs/_fs_copy.ts b/std/node/_fs/_fs_copy.ts index 0193e77c4..26d9a8c9a 100644 --- a/std/node/_fs/_fs_copy.ts +++ b/std/node/_fs/_fs_copy.ts @@ -1,17 +1,21 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { CallbackWithError } from "./_fs_common.ts"; +import { fromFileUrl } from "../path.ts"; export function copyFile( - source: string, + source: string | URL, destination: string, callback: CallbackWithError ): void { + source = source instanceof URL ? fromFileUrl(source) : source; + Deno.copyFile(source, destination) .then(() => callback()) .catch(callback); } -export function copyFileSync(source: string, destination: string): void { +export function copyFileSync(source: string | URL, destination: string): void { + source = source instanceof URL ? fromFileUrl(source) : source; Deno.copyFileSync(source, destination); } |