close
Skip to main content
This release is versions behind 1.1.6 — the latest version of @std/path.

@std/path@0.219.1
Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score100%
Downloads87,560/wk
Published2 years ago (0.219.1)

Utilities for working with file system paths

Functions

f
basename(
path: string,
suffix?
): string

Return the last portion of a path. Trailing directory separators are ignored, and optional suffix is removed.

f
common(
paths: string[],
sep?: string
): string

Determines the common path from a set of paths, using an optional separator, which defaults to the OS default separator.

f
dirname(path: string): string

Return the directory path of a path.

f
extname(path: string): string

Return the extension of the path with leading period.

f
format(pathObject: FormatInputPathObject): string

Generate a path from FormatInputPathObject object.

f
fromFileUrl(url: string | URL): string

Converts a file URL to a path string.

f
globToRegExp(
glob: string,
options?: GlobToRegExpOptions
): RegExp

Convert a glob string to a regular expression.

f
isAbsolute(path: string): boolean

Verifies whether provided path is absolute

f
isGlob(str: string): boolean

Test whether the given string is a glob

f
join(...paths: string[]): string

Join all given a sequence of paths,then normalizes the resulting path.

f
joinGlobs(
globs: string[],
options?: GlobOptions
): string

Like join(), but doesn't collapse "**/.." when globstar is true.

f
normalize(path: string): string

Normalize the path, resolving '..' and '.' segments. Note that resolving these segments does not necessarily mean that all will be eliminated. A '..' at the top-level will be preserved, and an empty path is canonically '.'.

f
normalizeGlob(
glob: string,
options?: GlobOptions
): string

Like normalize(), but doesn't collapse "**/.." when globstar is true.

f
parse(path: string): ParsedPath

Return a ParsedPath object of the path.

f
relative(
from: string,
to: string
): string

Return the relative path from from to to based on current working directory.

f
resolve(...pathSegments: string[]): string

Resolves path segments into a path

f
toFileUrl(path: string): URL

Converts a path string to a file URL.

f
toNamespacedPath(path: string): string

Resolves path to a namespace path

Interfaces

I

A parsed path object generated by path.parse() or consumed by path.format().

Type Aliases

T
FormatInputPathObject = Partial<ParsedPath>
No documentation available
T
GlobToRegExpOptions = GlobOptions & { os?: OSType; }
No documentation available

Variables

v
No documentation available
v
No documentation available
v
No documentation available
v
posix: _posix
No documentation available
v
win32: _windows
No documentation available