summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/copy_file.ts
blob: d2d2d5688269ca4bc867c13da11445b3c44f42c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

import { sendSync, sendAsync } from "../dispatch_json.ts";
import { pathFromURL } from "../../util.ts";

export function copyFileSync(
  fromPath: string | URL,
  toPath: string | URL,
): void {
  sendSync("op_copy_file", {
    from: pathFromURL(fromPath),
    to: pathFromURL(toPath),
  });
}

export async function copyFile(
  fromPath: string | URL,
  toPath: string | URL,
): Promise<void> {
  await sendAsync("op_copy_file", {
    from: pathFromURL(fromPath),
    to: pathFromURL(toPath),
  });
}