Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/fs/mod.ts>ensureSymlinkSync

The Deno Standard Library
Go to Latest
function ensureSymlinkSync
import { ensureSymlinkSync } from "https://deno.land/std@0.223.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.223.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.