website-scrap-engine
Version:
Configurable website scraper in typescript
24 lines • 1.11 kB
TypeScript
import type { BeforeRetryHook, OptionsInit, Response } from 'got';
import type { DownloadResource, RequestOptions } from './types.js';
import type { Resource } from '../resource.js';
import type { StaticDownloadOptions } from '../options.js';
/** Take logs before retry */
export declare const beforeRetryHook: BeforeRetryHook;
export interface DownloadError extends Partial<Error> {
retryLimitExceeded?: boolean;
code?: string;
event?: string;
}
/**
* workaround for retry premature close on node 12
* retry on empty body
*
* @param url
* @param options
*/
export declare function getRetry(url: string, options: OptionsInit): Promise<Response<Buffer | string> | void>;
export declare function requestForResource(res: Resource & {
downloadStartTimestamp: number;
}, requestOptions: RequestOptions, options?: StaticDownloadOptions): Promise<DownloadResource | Resource | void>;
export declare function downloadResource(res: Resource, requestOptions: RequestOptions, options: StaticDownloadOptions): Promise<DownloadResource | Resource | void>;
//# sourceMappingURL=download-resource.d.ts.map