import type { symlink as symlinkSync } from "node:fs";
/**
 * Ensures that the link exists, and points to a valid file.
 * If the directory structure does not exist, it is created.
 * If the link already exists, it is not modified but error is thrown if it is not point to the given target.
 * @param target the source file path
 * @param linkName the destination link path
 * @param type the type of the symlink, or null to use automatic detection
 * @returns A void promise that resolves once the link exists.
 * @example
 * ```javascript
 * import { ensureSymlink } from "@visulima/fs";
 * import { join } from "node:path";
 *
 * // Ensure a symlink /tmp/foo/link-to-bar.txt points to /tmp/foo/bar.txt
 * await ensureSymlink(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "link-to-bar.txt"));
 *
 * // Ensure a directory symlink /tmp/foo/link-to-baz-dir points to /tmp/foo/baz-dir
 * await ensureSymlink(join("/tmp", "foo", "baz-dir"), join("/tmp", "foo", "link-to-baz-dir"), "dir");
 * ```
 */
declare const ensureSymlink: (target: URL | string, linkName: URL | string, type?: symlinkSync.Type) => Promise<void>;
export default ensureSymlink;
