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

x/deno/cli/dts/lib.deno.ns.d.ts>Deno.realPathSync

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.realPathSync
allow-read
import { Deno } from "https://deno.land/x/deno@v1.28.1/cli/dts/lib.deno.ns.d.ts";
const { realPathSync } = Deno;

Synchronously returns absolute normalized path, with symbolic links resolved.

// e.g. given /home/alice/file.txt and current directory /home/alice
Deno.symlinkSync("file.txt", "symlink_file.txt");
const realPath = Deno.realPathSync("./file.txt");
const realSymLinkPath = Deno.realPathSync("./symlink_file.txt");
console.log(realPath);  // outputs "/home/alice/file.txt"
console.log(realSymLinkPath);  // outputs "/home/alice/file.txt"

Requires allow-read permission for the target path.

Also requires allow-read permission for the CWD if the target path is relative.

Parameters

path: string | URL

Returns

string