path-scurry
    Preparing search index...

    Class PathScurryBaseAbstract

    The base class for all PathScurry classes, providing the interface for path resolution and filesystem operations.

    Typically, you should not instantiate this class directly, but rather one of the platform-specific classes, or the exported PathScurry which defaults to the current platform.

    Hierarchy (View Summary)

    Index

    Constructors

    • Internal

      This class should not be instantiated directly.

      Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry

      Parameters

      • cwd: string | URL = ...
      • pathImpl: typeof path
      • sep: string | RegExp
      • __namedParameters: PathScurryOpts = {}

      Returns PathScurryBase

    Properties

    The Path entry corresponding to this PathScurry's current working directory.

    nocase: boolean

    Perform path comparisons case-insensitively.

    Defaults true on Darwin and Windows systems, false elsewhere.

    root: PathBase

    The root Path entry for the current working directory of this Scurry

    rootPath: string

    The string path for the root of this Scurry's current working directory

    roots: { [k: string]: PathBase }

    A collection of all roots encountered, referenced by rootPath

    sep: string | RegExp

    The path separator used for parsing paths

    '/' on Posix systems, either '/' or '\\' on Windows

    Methods

    • Return the basename for the provided string or Path object

      Parameters

      Returns string

    • Get the depth of a provided path, string, or the cwd

      Parameters

      • path: string | Path = ...

      Returns number

    • Return the dirname for the provided string or Path object

      Parameters

      Returns string

    • Determine whether a given path string is absolute

      Parameters

      • p: string

      Returns boolean

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

      Parameters

      Returns Promise<PathBase | undefined>

    • Internal

      Parse the root portion of a path string

      Parameters

      • dir: string

      Returns string

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

      Returns Promise<PathBase[]>

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

      Parameters

      • opts: { withFileTypes: true }

      Returns Promise<PathBase[]>

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

      Parameters

      • opts: { withFileTypes: false }

      Returns Promise<string[]>

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

      Parameters

      • opts: { withFileTypes: boolean }

      Returns Promise<PathBase[] | string[]>

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

      Parameters

      Returns Promise<PathBase[]>

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

      Parameters

      • entry: string | PathBase
      • opts: { withFileTypes: true }

      Returns Promise<PathBase[]>

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

      Parameters

      • entry: string | PathBase
      • opts: { withFileTypes: false }

      Returns Promise<string[]>

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

      Parameters

      • entry: string | PathBase
      • opts: { withFileTypes: boolean }

      Returns Promise<PathBase[] | string[]>

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

      Returns Promise<string | undefined>

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

      Parameters

      • opt: { withFileTypes: false }

      Returns Promise<string | undefined>

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

      Parameters

      • opt: { withFileTypes: true }

      Returns Promise<PathBase | undefined>

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

      Parameters

      • opt: { withFileTypes: boolean }

      Returns Promise<string | PathBase | undefined>

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

      Parameters

      • entry: string | PathBase
      • Optionalopt: { withFileTypes: false }

      Returns Promise<string | undefined>

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

      Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: true }

      Returns Promise<PathBase | undefined>

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

      Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: boolean }

      Returns Promise<string | PathBase | undefined>

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

      Returns Promise<string | undefined>

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

      Parameters

      • opt: { withFileTypes: false }

      Returns Promise<string | undefined>

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

      Parameters

      • opt: { withFileTypes: true }

      Returns Promise<PathBase | undefined>

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

      Parameters

      • opt: { withFileTypes: boolean }

      Returns Promise<string | PathBase | undefined>

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

      Parameters

      • entry: string | PathBase
      • Optionalopt: { withFileTypes: false }

      Returns Promise<string | undefined>

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

      Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: true }

      Returns Promise<PathBase | undefined>

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

      Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: boolean }

      Returns Promise<string | PathBase | undefined>

    • Returns string | undefined

    • Parameters

      • opt: { withFileTypes: false }

      Returns string | undefined

    • Parameters

      • opt: { withFileTypes: true }

      Returns PathBase | undefined

    • Parameters

      • opt: { withFileTypes: boolean }

      Returns string | PathBase | undefined

    • Parameters

      • entry: string | PathBase
      • Optionalopt: { withFileTypes: false }

      Returns string | undefined

    • Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: true }

      Returns PathBase | undefined

    • Parameters

      • entry: string | PathBase
      • opt: { withFileTypes: boolean }

      Returns string | PathBase | undefined

    • find the relative path from the cwd to the supplied path string or entry

      Parameters

      Returns string

    • find the relative path from the cwd to the supplied path string or entry, using / as the path delimiter, even on Windows.

      Parameters

      Returns string

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

      Parameters

      • ...paths: string[]

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

      Parameters

      • ...paths: string[]

      Returns string

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

      Returns Promise<PathBase[]>

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

      Returns Promise<PathBase[]>

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

      Returns Promise<string[]>

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

      Parameters

      Returns Promise<PathBase[] | string[]>

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

      Parameters

      Returns Promise<PathBase[]>

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

      Returns Promise<PathBase[]>

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

      Parameters

      Returns Promise<string[]>

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

      Parameters

      Returns Promise<PathBase[] | string[]>

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

      Returns PathBase[]

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

      Returns PathBase[]

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

      Returns string[]

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

      Parameters

      Returns PathBase[] | string[]

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

      Parameters

      Returns PathBase[]

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

      Returns PathBase[]

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

      Parameters

      Returns string[]

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

      Parameters

      Returns PathBase[] | string[]