UNPKG

pacote-install

Version:

A tool to download npm packages from specific registries

17 lines (16 loc) 492 B
interface RetryOptions { retries?: number; factor?: number; minTimeout?: number; maxTimeout?: number; onRetry?: (error: Error, attempt: number) => void; beforeFinish?: (res: any, attempt: number) => void; } /** * 带重试的异步操作执行器 * @param fn 要执行的异步函数 * @param options 重试选项 * @returns 异步结果 */ export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>; export default withRetry;