node-multi-curl
Version:
A performant multi-curl class in Node.js that supports proxies and concurrent requests
30 lines (29 loc) • 772 B
TypeScript
import { Request } from './Request';
export interface IMultiCurlOptions {
concurrency?: number;
timeout?: number;
retries?: number;
proxies?: string[];
curlConfig?: {
useDocker?: boolean;
dockerImage?: string;
};
}
export interface IRequestOptions {
url: string;
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
headers?: Record<string, string>;
body?: any;
proxy?: string;
timeout?: number;
queryParams?: Record<string, string | number | boolean | null | undefined>;
startTime?: number;
}
export interface IResponseOptions {
url: string;
body: string;
error?: string | null;
statusCode: number;
headers?: Record<string, string>;
request: Request;
}