Abstract
Internal
Do not create new Path objects directly. They should always be accessed via the PathScurry class or other methods on the Path class.
Private
Optional
#asyncPrivate
Optional
#atimePrivate
Optional
#atimePrivate
Optional
#birthtimePrivate
Optional
#birthtimePrivate
Optional
#blksizePrivate
Optional
#blocksPrivate
#childrenPrivate
Optional
#ctimePrivate
Optional
#ctimePrivate
Optional
#depthPrivate
Optional
#devPrivate
#fsPrivate
Optional
#fullpathPrivate
Optional
#fullpathPrivate
Optional
#gidPrivate
Optional
#inoPrivate
Optional
#linkPrivate
#matchPrivate
Optional
#modePrivate
Optional
#mtimePrivate
Optional
#mtimePrivate
Optional
#nlinkPrivate
#onPrivate
Optional
#rdevPrivate
#readdirCBInPrivate
Optional
#realpathPrivate
Optional
#relativePrivate
Optional
#relativePrivate
Optional
#sizePrivate
#typePrivate
Optional
#uidthe basename of this path
Important: always test the path name against any test string usingthe isNamed method, and not by directly comparing this string. Otherwise, unicode path strings that the system sees as identical will not be properly treated as the same path, leading to incorrect behavior and possible security issues.
Internal
nocaseboolean indicating whether paths are compared case-insensitively
Optional
Internal
parenta reference to the parent path, or undefined in the case of root entries
Internal
rootthe Path entry corresponding to the path root.
Internal
rootsAll roots found within the current PathScurry family
Abstract
sepThe path separator string to use when joining paths
Abstract
splitthe string or regexp used to split paths. On posix, it is '/'
, and on
windows it is a RegExp matching either '/'
or '\\'
This property is for compatibility with the Dirent class as of Node v20, where Dirent['path'] refers to the path of the directory that was passed to readdir. So, somewhat counterintuitively, this property refers to the parent path, not the path object itself. For root entries, it's the path to the entry itself.
Private
#applyPrivate
#callPrivate
#lstatPrivate
#markPrivate
#markENOENTPrivate
#markENOREALPATHPrivate
#markENOTDIRPrivate
#readdirPrivate
#readdirPrivate
#readdirPrivate
#readdirPrivate
#readdirPrivate
#readdirPrivate
#readlinkPrivate
#resolveInternal
Resolves a path portion and returns or creates the child Path.
Returns this
if pathPart is ''
or '.'
, or parent
if pathPart is
'..'
.
This should not be called directly. If pathPart
contains any path
separators, it will lead to unsafe undefined behavior.
Use Path.resolve()
instead.
Optional
opts: PathOptsInternal
Abstract
getAbstract
getReturn true if the path is a match for the given path name. This handles case sensitivity and unicode normalization.
Note: even on case-sensitive systems, it is not safe to test the
equality of the .name
property to determine whether a given pathname
matches, due to unicode normalization mismatches.
Always use this method instead of testing the path.name
property
directly.
Call lstat() on this Path, and update all known information that can be determined.
Note that unlike fs.lstat()
, the returned value does not contain some
information, such as mode
, dev
, nlink
, and ino
. If that
information is required, you will need to call fs.lstat
yourself.
If the Path refers to a nonexistent file, or if the lstat call fails for
any reason, undefined
is returned. Otherwise the updated Path object is
returned.
Results are cached, and thus may be out of date if the filesystem is mutated.
Abstract
newStandard node-style callback interface to get list of directory entries.
If the Path cannot or does not contain any children, then an empty array is returned.
Results are cached, and thus may be out of date if the filesystem is mutated.
The callback called with (er, entries). Note that the er
param is somewhat extraneous, as all readdir() errors are handled and
simply result in an empty set of entries being returned.
Boolean indicating that immediately known results should
not be deferred with queueMicrotask
. Defaults to false
. Release
zalgo at your peril, the dark pony lord is devious and unforgiving.
Returns the cached child Path entries array if the entry has been the subject of a successful readdir(), or [] otherwise.
Does not read the filesystem, so an empty array could just mean we don't have any cached data. Only use it if you are very sure that a readdir() has been called recently enough to still be valid.
Return the Path object corresponding to the target of a symbolic link.
If the Path is not a symbolic link, or if the readlink call fails for any
reason, undefined
is returned.
Result is cached, and thus may be outdated if the filesystem is mutated.
Return the cached link target if the entry has been the subject of a successful readlink, or undefined otherwise.
Does not read the filesystem, so an undefined result could just mean we don't have any cached data. Only use it if you are very sure that a readlink() has been called at some point.
Return the Path object corresponding to path as resolved by realpath(3).
If the realpath call fails for any reason, undefined
is returned.
Result is cached, and thus may be outdated if the filesystem is mutated. On success, returns a Path object.
Returns the cached realpath target if the entry has been the subject of a successful realpath, or undefined otherwise.
Does not read the filesystem, so an undefined result could just mean we don't have any cached data. Only use it if you are very sure that a realpath() has been called at some point.
Generated using TypeDoc
Path objects are sort of like a super-powered fs.Dirent
Each one represents a single filesystem entry on disk, which may or may not exist. It includes methods for reading various types of information via lstat, readlink, and readdir, and caches all information to the greatest degree possible.
Note that fs operations that would normally throw will instead return an "empty" value. This is in order to prevent excessive overhead from error stack traces.