Skip to main content
Module

std/fs/mod.ts>ensureSymlinkSync

The Deno Standard Library
Latest
function ensureSymlinkSync
import { ensureSymlinkSync } from "https://deno.land/std@0.224.0/fs/mod.ts";

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.

Examples

Example 1

import { ensureSymlinkSync } from "https://deno.land/std@0.224.0/fs/ensure_symlink.ts";

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

Parameters

target: string | URL

The source file path as a string or URL.

linkName: string | URL

The destination link path as a string or URL.