2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-03-08 08:09:22 -04:00
|
|
|
import { sendSync, sendAsync } from "./ops/dispatch_json.ts";
|
2019-04-08 09:11:32 -04:00
|
|
|
|
2020-03-02 10:19:42 -05:00
|
|
|
/** Creates `newname` as a hard link to `oldname`.
|
2019-04-08 09:11:32 -04:00
|
|
|
*
|
|
|
|
* Deno.linkSync("old/name", "new/name");
|
2020-03-02 10:19:42 -05:00
|
|
|
*
|
|
|
|
* Requires `allow-read` and `allow-write` permissions. */
|
2019-04-08 09:11:32 -04:00
|
|
|
export function linkSync(oldname: string, newname: string): void {
|
2020-02-25 09:14:27 -05:00
|
|
|
sendSync("op_link", { oldname, newname });
|
2019-04-08 09:11:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Creates `newname` as a hard link to `oldname`.
|
|
|
|
*
|
|
|
|
* await Deno.link("old/name", "new/name");
|
2020-03-02 10:19:42 -05:00
|
|
|
*
|
|
|
|
* Requires `allow-read` and `allow-write` permissions. */
|
2019-04-08 09:11:32 -04:00
|
|
|
export async function link(oldname: string, newname: string): Promise<void> {
|
2020-02-25 09:14:27 -05:00
|
|
|
await sendAsync("op_link", { oldname, newname });
|
2019-04-08 09:11:32 -04:00
|
|
|
}
|