PurePath.joinpath() method
pathlib-ts > PurePath > joinpath
PurePath.joinpath() method
Section titled “PurePath.joinpath() method”Produces a new path by appending additional segments to the current instance.
Signature:
joinpath<T extends PurePath>(this: T, ...segments: Array<PathLike>): T;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
this |
T | |
|
segments |
Array<PathLike> |
Path fragments to append in order. |
Returns:
T
A new path instance with the appended segments.
Remarks
Section titled “Remarks”Relative segments extend the existing location, while an absolute or anchored segment replaces the accumulated path, matching CPython and Node path joining semantics. The return type preserves the concrete subclass (Posix or Windows).
Example
Section titled “Example”Building a nested resource path
import { PurePath } from "pathlib-ts";
const project = new PurePath("/workspace");const config = project.joinpath("packages", "docs", "astro.config.mjs");console.log(config.toString());