UNPKG

recrawl

Version:

[![npm](https://img.shields.io/npm/v/recrawl.svg)](https://www.npmjs.com/package/recrawl) [![ci](https://github.com/aleclarson/recrawl/actions/workflows/release.yml/badge.svg)](https://github.com/aleclarson/recrawl/actions/workflows/release.yml) [![codeco

29 lines (28 loc) 1.35 kB
import { Crawler, RecrawlOptions } from './types'; /** Create a crawl function, and crawl the given root immediately */ export declare const crawl: (root: string, opts?: { only?: (string | RegExp)[] | undefined; skip?: (string | RegExp)[] | undefined; deep?: boolean | undefined; depth?: number | undefined; enter?: import("./types").DirFilter | undefined; filter?: import("./types").FileFilter | undefined; follow?: number | boolean | import("./types").LinkFilter | undefined; adapter?: import("./fs").FileAdapter | undefined; absolute?: boolean | undefined; }) => Promise<string[]>; /** Create a crawl function */ export declare function recrawl<T extends RecrawlOptions>(opts?: T): Crawler<T>; /** Provide the `name` argument to avoid unnecessary `path.basename` calls */ export declare type GlobMatcher = (file: string, name?: string) => boolean; /** * Compile a single Recrawl glob string into its "RegExp pattern" equivalent. * * Note: This is only useful for globs with "/" or "**" in them. */ export declare function compileGlob(glob: string, root?: string): string; /** * Create a function that tests against an array of Recrawl glob strings by * compiling them into RegExp objects. */ export declare function createMatcher(globs: (string | RegExp)[] | undefined, root?: string): GlobMatcher | null;