2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-09-02 17:07:11 -04:00
|
|
|
import { sendSync, sendAsync } from "./dispatch_json.ts";
|
2019-04-08 09:11:32 -04:00
|
|
|
|
|
|
|
/** Synchronously creates `newname` as a hard link to `oldname`.
|
|
|
|
*
|
|
|
|
* Deno.linkSync("old/name", "new/name");
|
|
|
|
*/
|
|
|
|
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");
|
|
|
|
*/
|
|
|
|
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
|
|
|
}
|