summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/symlink.ts
blob: 64074ec2d962f77451f64dba336d9752b6e4e9cb (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
25
26
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { sendSync, sendAsync } from "../dispatch_json.ts";
import * as util from "../../util.ts";
import { build } from "../../build.ts";

export function symlinkSync(
  oldpath: string,
  newpath: string,
  type?: string
): void {
  if (build.os === "windows" && type) {
    return util.notImplemented();
  }
  sendSync("op_symlink", { oldpath, newpath });
}

export async function symlink(
  oldpath: string,
  newpath: string,
  type?: string
): Promise<void> {
  if (build.os === "windows" && type) {
    return util.notImplemented();
  }
  await sendAsync("op_symlink", { oldpath, newpath });
}