summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_copy.ts
blob: 320c2fb3e87ae212cd324c4c545c5ac5532b85cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

import { CallbackWithError } from "./_fs_common.ts";

export function copyFile(
  source: string,
  destination: string,
  callback: CallbackWithError
): void {
  Deno.copyFile(source, destination)
    .then(() => callback())
    .catch(callback);
}

export function copyFileSync(source: string, destination: string): void {
  try {
    Deno.copyFileSync(source, destination);
  } catch (err) {
    throw err;
  }
}