close
Skip to main content

@std/path@1.1.5
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%
License
MIT
Downloads123,534/wk
Publisheda week ago (1.1.5)

Utilities for working with file system paths

Functions

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

Return the last portion of a path.

f
common(paths: string[]): string

Determines the common path from a set of paths for the given OS.

f
dirname(path: string | URL): string

Return the directory path of a path.

f
extname(path: string | URL): string

Return the extension of the path with leading period (".").

f
format(pathObject: Partial<ParsedPath>): string

Generate a path from a ParsedPath object. It does the opposite of parse().

f
fromFileUrl(url: string | URL): string

Converts a file URL to a path string.

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

Converts 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(
path: string | URL,
...paths: string[]
): string

Joins a sequence of paths, then normalizes the resulting path.

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

Joins a sequence of globs, then normalizes the resulting glob.

f
normalize(path: string | URL): string

Normalize the path, resolving '..' and '.' segments.

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

Normalizes a glob string.

f
parse(path: string): ParsedPath

Return an object containing the parsed components 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. This is a no-op on non-windows systems.

Interfaces

I

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

Type Aliases

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

Variables

v
DELIMITER: ";" | ":"

The character used to separate entries in the PATH environment variable. On Windows, this is ;. On all other platforms, this is :.

v
SEPARATOR: "\\" | "/"

The character used to separate components of a file path. On Windows, this is \. On all other platforms, this is /.

v
SEPARATOR_PATTERN: RegExp | RegExp

A regular expression that matches one or more path separators.

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