Skip to content

[F] resolvePath

function resolvePath(path, ...paths): string

Combines and resolves paths. If a path is absolute, it replaces any previous path. Any . and .. path components are resolved. Trailing directory separators are preserved.

resolvePath("/path", "to", "file.ext") === "path/to/file.ext"
resolvePath("/path", "to", "file.ext/") === "path/to/file.ext/"
resolvePath("/path", "dir", "..", "to", "file.ext") === "path/to/file.ext"

Parameters

ParameterType
pathstring
paths(undefined | string)[]

Returns

string