UNPKG

recrawl-sync

Version:

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

28 lines (27 loc) 1.01 kB
import { FileAdapter } from './fs'; export declare type DirFilter = (dir: string, depth: number) => boolean; export declare type FileFilter = (file: string, name: string) => boolean; export declare type LinkFilter = (link: string, depth: number) => boolean; export declare type RecrawlOptions = Options; declare type Options = { only?: (string | RegExp)[]; skip?: (string | RegExp)[]; deep?: boolean; depth?: number; enter?: DirFilter; filter?: FileFilter; follow?: boolean | number | LinkFilter; adapter?: FileAdapter; absolute?: boolean; }; export declare type EachArg = (file: string, link: string | null) => void; export declare type FilesArg = FileMap | string[]; export declare type FileMap = { [name: string]: string | boolean; }; export interface Crawler<T extends Options> { (root: string): T['follow'] extends true | LinkFilter ? FileMap : string[]; (root: string, each: EachArg): void; <T extends FilesArg>(root: string, files: T): T; } export {};