import type { symlink } 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. * @example * ```javascript * import { ensureSymlinkSync } from "@visulima/fs"; * import { join } from "node:path"; * * // Ensure a symlink /tmp/foo/link-to-bar.txt points to /tmp/foo/bar.txt * ensureSymlinkSync(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 * ensureSymlinkSync(join("/tmp", "foo", "baz-dir"), join("/tmp", "foo", "link-to-baz-dir"), "dir"); * ``` */ declare const ensureSymlinkSync: (target: URL | string, linkName: URL | string, type?: symlink.Type) => void; export default ensureSymlinkSync;