import type { CallbackWithError } from "./_fs_common.ts";import { fromFileUrl } from "../path.ts";import { promisify } from "../internal/util.mjs";
export function link( existingPath: string | URL, newPath: string | URL, callback: CallbackWithError,) { existingPath = existingPath instanceof URL ? fromFileUrl(existingPath) : existingPath; newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
Deno.link(existingPath, newPath).then(() => callback(null), callback);}
export const linkPromise = promisify(link) as ( existingPath: string | URL, newPath: string | URL,) => Promise<void>;
export function linkSync( existingPath: string | URL, newPath: string | URL,) { existingPath = existingPath instanceof URL ? fromFileUrl(existingPath) : existingPath; newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
Deno.linkSync(existingPath, newPath);}