@visulima/fs
Version:
Human friendly file system utilities for Node.js
17 lines (16 loc) • 626 B
TypeScript
/**
* Ensures that the hard link exists.
* If the directory structure does not exist, it is created.
* @param source The path to the source file or directory.
* @param destination The path to the destination link.
* @example
* ```javascript
* import { ensureLink } from "@visulima/fs";
* import { join } from "node:path";
*
* // ensure the link /tmp/foo/bar-link.txt points to /tmp/foo/bar.txt
* await ensureLink(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "bar-link.txt"));
* ```
*/
declare const ensureLink: (source: URL | string, destination: URL | string) => Promise<void>;
export default ensureLink;