Skip to content

path

luau
local path = require("@std/path")

path.basename

Returns the last component of path (the filename or directory name), or nil if the path has no components.

luau
(path: Pathlike) -> string?

path.dirname

Returns the directory portion of path as a string (everything except the last component).

luau
(path: Pathlike) -> string

path.extname

Returns the file extension of path (including the leading dot), or "" if there is none.

luau
(path: Pathlike) -> string

path.format

Converts path to its string representation using the platform's separator.

luau
(path: Pathlike) -> string

path.isAbsolute

Returns true if path is absolute.

luau
(path: Pathlike) -> boolean

path.join

Joins one or more path segments together into a single Path. Each segment after the first must be relative.

luau
(...: Pathlike) -> Path

path.normalize

Returns a normalized form of path, resolving . and .. components and removing redundant separators.

luau
(path: Pathlike) -> Path

path.parse

Parses path into a structured Path value.

luau
(path: Pathlike) -> Path

path.relative

Returns the relative path from from to to. Both paths must be of the same kind (both absolute or both relative).

luau
(from: Pathlike, to: Pathlike) -> Path

path.resolve

Resolves a sequence of paths into an absolute Path, processing right-to-left and falling back to the current working directory.

luau
(...: Pathlike) -> Path