Skip to main content
default.PlatformPath.relative - node__path.d.ts - Node documentation
method default.PlatformPath.relative

Usage in Deno

```typescript import type mod from "node:node__path.d.ts"; ```
PlatformPath.relative(
from: string,
to: string,
): string
Solve the relative path from {from} to {to} based on the current working directory. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

Parameters

from: string
to: string

Return Type

string

Throws

TypeError
if either `from` or `to` is not a string.