Private
#childrenPrivate
#fsPrivate
#resolvePrivate
#resolveThe Path entry corresponding to this PathScurry's current working directory.
Perform path comparisons case-insensitively.
Defaults true on Darwin and Windows systems, false elsewhere.
The root Path entry for the current working directory of this Scurry
The string path for the root of this Scurry's current working directory
A collection of all roots encountered, referenced by rootPath
separator for generating path strings
Support for for await
Alias for iterate
Note: As of Node 19, this is very slow, compared to other methods of walking. Consider using stream if memory overhead and backpressure are concerns, or walk if not.
Iterating over a PathScurry performs a synchronous walk.
Alias for iterateSync
Internal
Return the cache of child entries. Exposed so subclasses can create child Path objects in a platform-specific way.
Async generator form of walk
Note: As of Node 19, this is very slow, compared to other methods of walking, especially if most/all of the directory tree has been previously walked. Consider using stream if memory overhead and backpressure are concerns, or walk if not.
Call lstat() on the string or Path object, 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.
Return an array of known child entries.
First argument may be either a string, or a Path object.
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.
Unlike fs.readdir()
, the withFileTypes
option defaults to true
. Set
{ withFileTypes: false }
to return strings.
synchronous readdir
Return the Path object or string path 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.
{withFileTypes}
option defaults to false
.
On success, returns a Path object if withFileTypes
option is true,
otherwise a string.
Optional
opt: { synchronous readlink
Optional
opt: { Return the Path object or string path 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.
{withFileTypes}
option defaults to false
.
On success, returns a Path object if withFileTypes
option is true,
otherwise a string.
Optional
opt: { Optional
opt: { Resolve one or more path strings to a resolved string
Same interface as require('path').resolve.
Much faster than path.resolve() when called multiple times for the same path, because the resolved Path objects are cached. Much slower otherwise.
Rest
...paths: string[]Resolve one or more path strings to a resolved string, returning the posix path. Identical to .resolve() on posix systems, but on windows will return a forward-slash separated UNC path.
Same interface as require('path').resolve.
Much faster than path.resolve() when called multiple times for the same path, because the resolved Path objects are cached. Much slower otherwise.
Rest
...paths: string[]Stream form of walk
Returns a Minipass stream that emits PathBase objects by default,
or strings if { withFileTypes: false }
is set in the options.
Synchronous form of stream
Returns a Minipass stream that emits PathBase objects by default,
or strings if { withFileTypes: false }
is set in the options.
Will complete the walk in a single tick if the stream is consumed fully. Otherwise, will pause as needed for stream backpressure.
Asynchronously walk the directory tree, returning an array of all path strings or Path objects found.
Note that this will be extremely memory-hungry on large filesystems. In such cases, it may be better to use the stream or async iterator walk implementation.
Synchronously walk the directory tree, returning an array of all path strings or Path objects found.
Note that this will be extremely memory-hungry on large filesystems. In such cases, it may be better to use the stream or async iterator walk implementation.
Generated using TypeDoc
PathScurryBase implementation for Darwin (macOS) systems.
Defaults to case-insensitive matching, uses
'/'
for generating path strings.Uses PathPosix for Path objects.