The path
module provides utilities for working with file and directory paths.
See also:
Static variables
staticread onlyposix:PathModule
The path.posix
property provides access to POSIX specific implementations of the path
methods.
See also:
staticread onlysep:String
Provides the platform-specific path segment separator:
\
on Windows
/
on POSIX
See also:
staticread onlywin32:PathModule
The path.win32 property provides access to Windows-specific implementations of the path methods.
See also:
Static methods
staticbasename(path:String, ?ext:String):String
The path.basename()
methods returns the last portion of a path
, similar to the Unix basename
command. Trailing directory separators are ignored, see path.sep.
See also:
staticdirname(path:String):String
The path.dirname()
method returns the directory name of a path
, similar to the Unix dirname
command. Trailing directory separators are ignored, see path.sep.
See also:
staticextname(path:String):String
The path.extname()
method returns the extension of the path
, from the last occurrence of the .
(period) character to end of string in the last portion of the path
.
If there is no .
in the last portion of the path
, or if there are no .
characters other than the first character of the basename of path
(see path.basename()
) ,
an empty string is returned.
See also:
staticformat(pathObject:PathObject):String
The path.format() method returns a path string from an object. This is the opposite of path.parse().
See also:
staticisAbsolute(path:String):Bool
The path.isAbsolute()
method determines if path
is an absolute path.
See also:
staticjoin(paths:Rest<String>):String
The path.join()
method joins all given path
segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.
See also:
staticnormalize(path:String):String
The path.normalize()
method normalizes the given path
, resolving '..'
and '.'
segments.
See also:
staticparse(path:String):PathObject
The path.parse()
method returns an object whose properties represent significant elements of the path
. Trailing directory separators are ignored, see path.sep.
See also:
staticrelative(from:String, to:String):String
The path.relative()
method returns the relative path from from
to to
based on the current working directory.
If from
and to
each resolve to the same path (after calling path.resolve() on each), a zero-length string is returned.
See also:
staticresolve(paths:Rest<String>):String
The path.resolve()
method resolves a sequence of paths or path segments into an absolute path.
See also:
statictoNamespacedPath(path:String):String
On Windows systems only, returns an equivalent namespace-prefixed path for the given path
. If path
is not a string, path
will be returned without modifications.
See also: