Skip to main content
function ensureSymlinkSync
import { ensureSymlinkSync } from "";

Synchronously 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.

Requires the --allow-read and --allow-write flag.


Example 1

import { ensureSymlinkSync } from "";

ensureSymlinkSync("./folder/targetFile.dat", "./folder/");


target: string | URL

The source file path as a string or URL.

linkName: string | URL

The destination link path as a string or URL.