2019-04-08 09:11:32 -04:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-08-26 10:18:42 -04:00
|
|
|
import { sendSync, sendAsync } from "./dispatch_json";
|
|
|
|
import * as dispatch from "./dispatch";
|
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 {
|
2019-08-26 10:18:42 -04:00
|
|
|
sendSync(dispatch.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> {
|
2019-08-26 10:18:42 -04:00
|
|
|
await sendAsync(dispatch.OP_LINK, { oldname, newname });
|
2019-04-08 09:11:32 -04:00
|
|
|
}
|