DefinitelyTyped/types/website-scraper/index.d.ts
Andy 954ee278de
Update TypeScript Versions to be at least as high as dependencies' versions (#21288)
* Update `TypeScript Version`s to be at least as high as dependencies' versions

* Run through again
2017-11-08 09:12:14 -08:00

56 lines
1.5 KiB
TypeScript

// Type definitions for website-scraper v1.2.x
// Project: https://github.com/s0ph1e/node-website-scraper
// Definitions by: Christian Rackerseder <https://www.echooff.de>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as request from 'request';
declare namespace websiteScraper {
interface Url {
url: string;
filename: string;
}
interface SubDirectory {
directory: string;
extensions: string[];
}
interface Source {
selector: string;
attr: string;
}
interface RequestOptions {
headers: request.Headers
}
interface Options {
urls: Array<string | Url>;
directory: string;
urlFilter?: (url: string) => boolean;
filenameGenerator?: string;
defaultFilename?: string;
prettifyUrls?: boolean;
sources?: Source[];
subdirectories?: SubDirectory[] | null;
request?: RequestOptions;
recursive?: boolean;
maxDepth?: number;
ignoreErrors?: boolean;
}
interface Resource {
url: string;
filename: string;
assets: Resource[];
}
interface Callback {
(error: any | null, result: Resource[] | null): void;
}
interface scrape {
(options: Options, callback: Callback): void;
(options: Options): Promise<Resource[]>;
}
}
declare var websiteScraper: websiteScraper.scrape;
export = websiteScraper;