Function glob

Properties

escape: ((s: string, __namedParameters?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string)

Type declaration

    • (s, __namedParameters?): string
    • Escape all magic characters in a glob pattern.

      If the windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape option is used, then characters are escaped by wrapping in [], because a magic character wrapped in a character class can only be satisfied by that exact character. In this mode, `` is not escaped, because it is not interpreted as a magic character, but instead as a path separator.

      Parameters

      • s: string
      • Optional__namedParameters: Pick<MinimatchOptions, "windowsPathsNoEscape">

      Returns string

glob: {
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Promise<string[]>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Promise<Path[]>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Promise<string[]>;
    (pattern: string | string[], options: GlobOptions): Promise<Path[] | string[]>;
} = glob_

Type declaration

    • (pattern, options?): Promise<string[]>
    • Perform an asynchronous glob search for the pattern(s) specified. Returns Path objects if the withFileTypes option is set to true. See GlobOptions for full option descriptions.

      Parameters

      Returns Promise<string[]>

    • (pattern, options): Promise<Path[]>
    • Parameters

      Returns Promise<Path[]>

    • (pattern, options): Promise<string[]>
    • Parameters

      Returns Promise<string[]>

    • (pattern, options): Promise<Path[] | string[]>
    • Parameters

      Returns Promise<Path[] | string[]>

Glob: typeof Glob
globIterate: {
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): AsyncGenerator<string, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): AsyncGenerator<Path, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): AsyncGenerator<string, void, void>;
    (pattern: string | string[], options: GlobOptions): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>;
}

Type declaration

    • (pattern, options?): AsyncGenerator<string, void, void>
    • Return an async iterator for walking glob pattern matches.

      Parameters

      Returns AsyncGenerator<string, void, void>

    • (pattern, options): AsyncGenerator<Path, void, void>
    • Parameters

      Returns AsyncGenerator<Path, void, void>

    • (pattern, options): AsyncGenerator<string, void, void>
    • Parameters

      Returns AsyncGenerator<string, void, void>

    • (pattern, options): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>
    • Parameters

      Returns AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>

globIterateSync: {
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
    (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
}

Type declaration

    • (pattern, options?): Generator<string, void, void>
    • Return a sync iterator for walking glob pattern matches.

      Parameters

      Returns Generator<string, void, void>

    • (pattern, options): Generator<Path, void, void>
    • Parameters

      Returns Generator<Path, void, void>

    • (pattern, options): Generator<string, void, void>
    • Parameters

      Returns Generator<string, void, void>

    • (pattern, options): Generator<Path, void, void> | Generator<string, void, void>
    • Parameters

      Returns Generator<Path, void, void> | Generator<string, void, void>

globStream: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
}

Type declaration

    • (pattern, options): Minipass<string, string>
    • Return a stream that emits all the strings or Path objects and then emits end when completed.

      Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path>
    • Parameters

      Returns Minipass<Path, Path>

    • (pattern, options?): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
    • Parameters

      Returns Minipass<Path, Path> | Minipass<string, string>

globStreamSync: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
}

Type declaration

    • (pattern, options): Minipass<Path, Path>
    • Syncronous form of globStream. Will read all the matches as fast as you consume them, even all in a single tick if you consume them immediately, but will still respond to backpressure if they're not consumed immediately.

      Parameters

      Returns Minipass<Path, Path>

    • (pattern, options): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
    • Parameters

      Returns Minipass<Path, Path> | Minipass<string, string>

globSync: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): string[];
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Path[];
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): string[];
    (pattern: string | string[], options: GlobOptions): Path[] | string[];
}

Type declaration

hasMagic: ((pattern: string | string[], options?: GlobOptions) => boolean)

Type declaration

    • (pattern, options?): boolean
    • Return true if the patterns provided contain any magic glob characters, given the options provided.

      Brace expansion is not considered "magic" unless the magicalBraces option is set, as brace expansion just turns one string into an array of strings. So a pattern like 'x{a,b}y' would return false, because 'xay' and 'xby' both do not contain any magic glob characters, and it's treated the same as if you had called it on ['xay', 'xby']. When magicalBraces:true is in the options, brace expansion is treated as a pattern having magic.

      Parameters

      Returns boolean

iterate: {
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): AsyncGenerator<string, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): AsyncGenerator<Path, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): AsyncGenerator<string, void, void>;
    (pattern: string | string[], options: GlobOptions): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>;
} & {
    sync: {
        (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
    };
}

Type declaration

    • (pattern, options?): AsyncGenerator<string, void, void>
    • Return an async iterator for walking glob pattern matches.

      Parameters

      Returns AsyncGenerator<string, void, void>

    • (pattern, options): AsyncGenerator<Path, void, void>
    • Parameters

      Returns AsyncGenerator<Path, void, void>

    • (pattern, options): AsyncGenerator<string, void, void>
    • Parameters

      Returns AsyncGenerator<string, void, void>

    • (pattern, options): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>
    • Parameters

      Returns AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>

Type declaration

  • sync: {
        (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
    }
      • (pattern, options?): Generator<string, void, void>
      • Return a sync iterator for walking glob pattern matches.

        Parameters

        Returns Generator<string, void, void>

      • (pattern, options): Generator<Path, void, void>
      • Parameters

        Returns Generator<Path, void, void>

      • (pattern, options): Generator<string, void, void>
      • Parameters

        Returns Generator<string, void, void>

      • (pattern, options): Generator<Path, void, void> | Generator<string, void, void>
      • Parameters

        Returns Generator<Path, void, void> | Generator<string, void, void>

iterateSync: {
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
    (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
}

Type declaration

    • (pattern, options?): Generator<string, void, void>
    • Return a sync iterator for walking glob pattern matches.

      Parameters

      Returns Generator<string, void, void>

    • (pattern, options): Generator<Path, void, void>
    • Parameters

      Returns Generator<Path, void, void>

    • (pattern, options): Generator<string, void, void>
    • Parameters

      Returns Generator<string, void, void>

    • (pattern, options): Generator<Path, void, void> | Generator<string, void, void>
    • Parameters

      Returns Generator<Path, void, void> | Generator<string, void, void>

stream: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
} & {
    sync: {
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
    };
}

Type declaration

    • (pattern, options): Minipass<string, string>
    • Return a stream that emits all the strings or Path objects and then emits end when completed.

      Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path>
    • Parameters

      Returns Minipass<Path, Path>

    • (pattern, options?): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
    • Parameters

      Returns Minipass<Path, Path> | Minipass<string, string>

Type declaration

  • sync: {
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
    }
      • (pattern, options): Minipass<Path, Path>
      • Syncronous form of globStream. Will read all the matches as fast as you consume them, even all in a single tick if you consume them immediately, but will still respond to backpressure if they're not consumed immediately.

        Parameters

        Returns Minipass<Path, Path>

      • (pattern, options): Minipass<string, string>
      • Parameters

        Returns Minipass<string, string>

      • (pattern, options): Minipass<string, string>
      • Parameters

        Returns Minipass<string, string>

      • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
      • Parameters

        Returns Minipass<Path, Path> | Minipass<string, string>

streamSync: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
    (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
}

Type declaration

    • (pattern, options): Minipass<Path, Path>
    • Syncronous form of globStream. Will read all the matches as fast as you consume them, even all in a single tick if you consume them immediately, but will still respond to backpressure if they're not consumed immediately.

      Parameters

      Returns Minipass<Path, Path>

    • (pattern, options): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<string, string>
    • Parameters

      Returns Minipass<string, string>

    • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
    • Parameters

      Returns Minipass<Path, Path> | Minipass<string, string>

sync: {
    (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): string[];
    (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Path[];
    (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): string[];
    (pattern: string | string[], options: GlobOptions): Path[] | string[];
} & {
    iterate: {
        (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
    };
    stream: {
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
    };
}

Type declaration

Type declaration

  • iterate: {
        (pattern: string | string[], options?: GlobOptionsWithFileTypesUnset): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
        (pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
    }
      • (pattern, options?): Generator<string, void, void>
      • Return a sync iterator for walking glob pattern matches.

        Parameters

        Returns Generator<string, void, void>

      • (pattern, options): Generator<Path, void, void>
      • Parameters

        Returns Generator<Path, void, void>

      • (pattern, options): Generator<string, void, void>
      • Parameters

        Returns Generator<string, void, void>

      • (pattern, options): Generator<Path, void, void> | Generator<string, void, void>
      • Parameters

        Returns Generator<Path, void, void> | Generator<string, void, void>

  • stream: {
        (pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
        (pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
    }
      • (pattern, options): Minipass<Path, Path>
      • Syncronous form of globStream. Will read all the matches as fast as you consume them, even all in a single tick if you consume them immediately, but will still respond to backpressure if they're not consumed immediately.

        Parameters

        Returns Minipass<Path, Path>

      • (pattern, options): Minipass<string, string>
      • Parameters

        Returns Minipass<string, string>

      • (pattern, options): Minipass<string, string>
      • Parameters

        Returns Minipass<string, string>

      • (pattern, options): Minipass<Path, Path> | Minipass<string, string>
      • Parameters

        Returns Minipass<Path, Path> | Minipass<string, string>

unescape: ((s: string, __namedParameters?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string)

Type declaration

    • (s, __namedParameters?): string
    • Un-escape a string that has been escaped with escape.

      If the windowsPathsNoEscape option is used, then square-brace escapes are removed, but not backslash escapes. For example, it will turn the string '[*]' into *, but it will not turn '\\*' into '*', becuase \ is a path separator in windowsPathsNoEscape mode.

      When windowsPathsNoEscape is not set, then both brace escapes and backslash escapes are removed.

      Slashes (and backslashes in windowsPathsNoEscape mode) cannot be escaped or unescaped.

      Parameters

      • s: string
      • Optional__namedParameters: Pick<MinimatchOptions, "windowsPathsNoEscape">

      Returns string