Skip to main content

Utilities for working with file system paths

This package works with Cloudflare Workers, Deno, Browsers
This package works with Cloudflare Workers
This package works with Deno
This package works with Browsers
JSR Score
94%
Published
5 months ago (1.0.8)

default

Utilities for working with OS-specific file paths.

f
basename

Return the last portion of a path.

f
common

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

v
DELIMITER

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

f
dirname

Return the directory path of a path.

f
extname

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

f
format

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

f
fromFileUrl

Converts a file URL to a path string.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
globToRegExp

Converts a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

f
joinGlobs

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

f
normalize

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

f
normalizeGlob

Normalizes a glob string.

f
parse

Return an object containing the parsed components of the path.

I
ParsedPath

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

f
relative

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

f
resolve

Resolves path segments into a path.

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

A regular expression that matches one or more path separators.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Resolves path to a namespace path. This is a no-op on non-windows systems.

f
basename

Return the last portion of a path.

f
common

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

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

A regular expression that matches one or more path separators.

f
dirname

Return the directory path of a path.

f
extname

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

f
format

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

f
fromFileUrl

Converts a file URL to a path string.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
globToRegExp

Converts a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
joinGlobs

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

f
normalize

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

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
normalizeGlob

Normalizes a glob string.

f
parse

Return an object containing the parsed components of the path.

I
ParsedPath

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

posix

Utilities for working with POSIX-formatted paths.

f
basename

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

f
common

Determines the common path from a set of paths for POSIX systems.

v
DELIMITER

The character used to separate entries in the PATH environment variable.

f
dirname

Return the directory path of a path.

f
extname

Return the extension of the path with leading period.

f
format

Generate a path from ParsedPath object.

f
fromFileUrl

Converts a file URL to a path string.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
globToRegExp

Convert a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

f
joinGlobs

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

f
normalize

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

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

f
parse

Return a ParsedPath object of the path.

I
ParsedPath

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

f
relative

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

f
resolve

Resolves path segments into a path.

v
SEPARATOR

The character used to separate components of a file path.

v
SEPARATOR_PATTERN

A regular expression that matches one or more path separators.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Converts a path to a namespaced path. This function returns the path as is on posix.

f
basename

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

f
common

Determines the common path from a set of paths for POSIX systems.

v
DELIMITER

The character used to separate entries in the PATH environment variable.

v
SEPARATOR

The character used to separate components of a file path.

v
SEPARATOR_PATTERN

A regular expression that matches one or more path separators.

f
dirname

Return the directory path of a path.

f
extname

Return the extension of the path with leading period.

f
format

Generate a path from ParsedPath object.

f
fromFileUrl

Converts a file URL to a path string.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
globToRegExp

Convert a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
joinGlobs

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

f
normalize

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 '.'.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
normalizeGlob

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

f
parse

Return a ParsedPath object of the path.

I
ParsedPath

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

f
relative

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

f
resolve

Resolves path segments into a path.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Converts a path to a namespaced path. This function returns the path as is on posix.

f
basename

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

f
dirname

Return the directory path of a file URL.

f
extname

Return the extension of the path with leading period.

f
join

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

f
normalize

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
relative

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

f
resolve

Resolves path segments into a path.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Resolves path to a namespace path. This is a no-op on non-windows systems.

I
ParsedPath

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

f
basename

Return the last portion of a path.

f
dirname

Return the directory path of a file URL.

f
extname

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

f
join

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

f
normalize

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

windows

Utilities for working with Windows-specific paths.

f
basename

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

f
common

Determines the common path from a set of paths for Windows systems.

v
DELIMITER

The character used to separate entries in the PATH environment variable.

f
dirname

Return the directory path of a path.

f
extname

Return the extension of the path with leading period.

f
format

Generate a path from ParsedPath object.

f
fromFileUrl

Converts a file URL to a path string.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
globToRegExp

Convert a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

f
joinGlobs

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

f
normalize

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

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

f
parse

Return a ParsedPath object of the path.

I
ParsedPath

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

f
relative

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

f
resolve

Resolves path segments into a path.

v
SEPARATOR

The character used to separate components of a file path.

v
SEPARATOR_PATTERN

A regular expression that matches one or more path separators.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Resolves path to a namespace path

f
basename

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

f
common

Determines the common path from a set of paths for Windows systems.

v
DELIMITER

The character used to separate entries in the PATH environment variable.

v
SEPARATOR

The character used to separate components of a file path.

v
SEPARATOR_PATTERN

A regular expression that matches one or more path separators.

f
dirname

Return the directory path of a path.

f
extname

Return the extension of the path with leading period.

f
format

Generate a path from ParsedPath object.

f
fromFileUrl

Converts a file URL to a path string.

f
globToRegExp

Convert a glob string to a regular expression.

f
isAbsolute

Verifies whether provided path is absolute.

f
isGlob

Test whether the given string is a glob.

f
join

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

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
joinGlobs

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

f
normalize

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 '.'.

I
GlobOptions

Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.

f
normalizeGlob

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

f
parse

Return a ParsedPath object of the path.

I
ParsedPath

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

f
relative

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

f
resolve

Resolves path segments into a path.

f
toFileUrl

Converts a path string to a file URL.

f
toNamespacedPath

Resolves path to a namespace path

f
basename

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

f
dirname

Return the directory path of a file URL.

f
extname

Return the extension of the path with leading period.

f
join

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

f
normalize

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 '.'.