summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/copy_file.ts
blob: fcb147bddcc749b477305d4d63714b21e31a929d (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),
  });
}