@md-anas-sabah/async-task-runner
Version:
Powerful async task runner for Node.js with concurrency control, smart retries, timeouts & comprehensive reporting. Perfect for web scraping, API processing, file operations & bulk async operations.
15 lines • 577 B
TypeScript
import { TimeoutError } from './types.js';
export interface TimeoutResult<T> {
result: T;
duration: number;
timedOut: false;
}
export interface TimeoutFailure {
error: TimeoutError;
duration: number;
timedOut: true;
}
export type TimeoutOutcome<T> = TimeoutResult<T> | TimeoutFailure;
export declare function withTimeout<T>(task: () => Promise<T>, timeoutMs: number): Promise<TimeoutOutcome<T>>;
export declare function createAbortableTask<T>(originalTask: () => Promise<T>, signal?: AbortSignal): () => Promise<T>;
//# sourceMappingURL=timeout.d.ts.map