Files
DefinitelyTyped/website-scraper/index.d.ts
screendriver b398805089 Added type definitions for website-scraper v1.2.x (#12125)
* Added type definitions for website-scraper v1.2.x

* Renamed test file

* Fixed "files" in tsconfig.json

* Renamed test file

* Replaced module with namespace
2016-11-01 22:01:53 +09:00

51 lines
1.4 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
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;
}
function scrape(options: Options, callback: Callback): void;
function scrape(options: Options): Promise<Resource[]>;
}
export = websiteScraper;