ensureLink

import { ensureLink } from "jsr:@ende/fs";

function

async function ensureLink(src: string | URL, dest: string | URL): Promise<void>

Asynchronously ensures that the hard link exists.

If the parent directories for the hard link do not exist, they are created.

Requires --allow-read and --allow-write permissions.

src: string | URL

The source file path as a string or URL. Directory hard links are not allowed.

dest: string | URL

The destination link path as a string or URL.

Returns

A void promise that resolves once the hard link exists.

Example: Usage

import { ensureLink } from "@ende/fs/ensure-link";

await ensureLink("./folder/targetFile.dat", "./folder/targetFile.link.dat");

See also

Source