summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/symlink.ts
blob: fde611b55737ab7ca4c5019f6b6842cb21f1de1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { sendSync, sendAsync } from "../dispatch_json.ts";

export type symlinkOptions = {
  type: "file" | "dir";
};

export function symlinkSync(
  oldpath: string,
  newpath: string,
  options?: symlinkOptions
): void {
  sendSync("op_symlink", { oldpath, newpath, options });
}

export async function symlink(
  oldpath: string,
  newpath: string,
  options?: symlinkOptions
): Promise<void> {
  await sendAsync("op_symlink", { oldpath, newpath, options });
}