UNPKG

got

Version:

Human-friendly and powerful HTTP request library for Node.js

36 lines (35 loc) • 1.06 kB
import type { ClientRequest } from 'node:http'; declare const reentry: unique symbol; type TimedOutOptions = { host?: string; hostname?: string; protocol?: string; }; export type Delays = { lookup?: number; socket?: number; connect?: number; secureConnect?: number; send?: number; response?: number; read?: number; request?: number; }; export type ErrorCode = 'ETIMEDOUT' | 'ECONNRESET' | 'EADDRINUSE' | 'ECONNREFUSED' | 'EPIPE' | 'ENOTFOUND' | 'ENETUNREACH' | 'EAI_AGAIN'; export declare class TimeoutError extends Error { name: string; code: ErrorCode; event: string; constructor(threshold: number, event: string); } /** Whether a delay can be armed as a Node.js timer without collapsing into an instant timeout. */ export declare const isArmableTimerDelay: (delay: number) => boolean; export default function timedOut(request: ClientRequest, delays: Delays, options: TimedOutOptions): () => void; declare module 'http' { interface ClientRequest { [reentry]?: boolean; } } export {};