Skip to content

resolveRelative

The resolveRelative() function resolves multiple path segments into a single POSIX-like path.

WARNING

Works only with POSIX paths (not Windows paths).

Interactive example

Syntax

typescript
function resolveRelative(
    segments: readonly string[]
): string;

Parameters

  • segments : The path segments to resolve.

Return value

A resolved path string. Absolute segments reset the base path, and .. can stay leading when resolving above root.

See also

  • resolveFrom - Resolves a list of segments from an origin

Released under the MIT license.