Skip to content

Path ​

Path utilities to resolve and inspect POSIX paths.

How to import? ​

Path functions are exposed from the main entry or via direct import (tree-shaking friendly).

typescript
import { Path } from "@duplojs/utils";
import * as Path from "@duplojs/utils/common/path";

Checks ​

isAbsolute ​

Checks whether a path is absolute.

Cleanup ​

fix ​

Cleans a path by removing a trailing slash and a leading ./ prefix.

Resolution ​

resolveRelative ​

Resolves multiple segments into a single path.

resolveFrom ​

Resolves a list of segments from an origin.

Extraction ​

getParentFolderPath ​

Returns the parent folder of a path.

getBaseName ​

Returns the last segment of a path, with optional extension removal.

getExtensionName ​

Returns the extension of a path, including the dot.

Released under the MIT license.