FileHound
    Preparing search index...

    Interface FileView

    A read-only view of a file found by a search, as passed to predicates such as applyFilter. It has no methods that change the file system.

    Predicates may be called ahead of the matches being returned, at the same time as each other, and on files that are never returned, for example when a loop over FileHound.iterate is left early. So a predicate should have no side effects.

    A file's stats are fetched once, then shared by every predicate and by FileHound.includeFileStats.

    interface FileView {
        exists(): Promise<boolean>;
        getAbsolutePath(): string;
        getCanonicalPath(): string;
        getName(): string;
        getPathExtension(): string;
        getRelativePath(): string;
        getStats(): Promise<Stats>;
        getStatsSync(): Stats;
        isDirectory(): Promise<boolean>;
        isDirectorySync(): boolean;
        isExecutable(): Promise<boolean>;
        isFile(): Promise<boolean>;
        isFileSync(): boolean;
        isHidden(): Promise<boolean>;
        isHiddenSync(): boolean;
        isMatch(globPattern: string): boolean;
        isReadable(): Promise<boolean>;
        isSymbolicLink(): Promise<boolean>;
        isSymbolicLinkSync(): boolean;
        isWritable(): Promise<boolean>;
        lastAccessed(): Promise<Date>;
        lastAccessedSync(): Date;
        lastChanged(): Promise<Date>;
        lastChangedSync(): Date;
        lastModified(): Promise<Date>;
        lastModifiedSync(): Date;
        size(): Promise<number>;
        sizeSync(): number;
    }
    Index
    • Whether the file exists and can be read

      Returns Promise<boolean>

    • The absolute path

      Returns string

    • The absolute path, normalised

      Returns string

    • The path, as found from the search path

      Returns string

    • The extension, without the leading dot, or an empty string

      Returns string

    • The path relative to the search path

      Returns string

    • The stats, as returned by fs.stat

      Returns Promise<Stats>

    • The stats, as returned by fs.statSync

      Returns Stats

    • Whether this is a directory, or a link to one

      Returns Promise<boolean>

    • Whether this is a directory, or a link to one

      Returns boolean

    • Whether the file can be executed

      Returns Promise<boolean>

    • Whether this is a regular file, or a link to one

      Returns Promise<boolean>

    • Whether this is a regular file, or a link to one

      Returns boolean

    • Whether this is hidden: its name, or for a directory any in its path, begins with a dot

      Returns Promise<boolean>

    • Whether this is hidden: its name, or for a directory any in its path, begins with a dot

      Returns boolean

    • Whether the path, relative to the search path, matches a glob pattern

      Parameters

      • globPattern: string

      Returns boolean

    • Whether the file can be read

      Returns Promise<boolean>

    • Whether this is a symbolic link

      Returns Promise<boolean>

    • Whether this is a symbolic link

      Returns boolean

    • Whether the file can be written to

      Returns Promise<boolean>

    • When the file was last accessed

      Returns Promise<Date>

    • When the file was last accessed

      Returns Date

    • When the file's status, such as its permissions, last changed

      Returns Promise<Date>

    • When the file's status, such as its permissions, last changed

      Returns Date

    • When the contents were last modified

      Returns Promise<Date>

    • When the contents were last modified

      Returns Date

    • The size in bytes

      Returns Promise<number>

    • The size in bytes

      Returns number