UNPKG

andrade-soulseek-downloader

Version:

Simple, safe Soulseek download library with built-in rate limiting to prevent bans

32 lines 1.12 kB
import { IRateLimiter } from '../../shared'; /** * Rate limiter adapter using p-queue. * Prevents Soulseek bans by enforcing delays between operations. */ export declare class RateLimiterAdapter implements IRateLimiter { private queue; private lastSearchTime; private lastDownloadTime; private readonly searchDelay; private readonly downloadDelay; /** Initializes queue with concurrency limits */ constructor(); /** * Executes function with appropriate delay. * @param fn - Function to execute * @param type - Operation type for delay calculation * @returns Function result */ executeWithDelay<T>(fn: () => Promise<T>, type: 'search' | 'download'): Promise<T>; /** Applies operation-specific delay */ private applyDelay; /** Utility for promise-based delay */ private delay; /** @returns Number of queued operations */ getQueueSize(): number; /** @returns Number of pending operations */ getPendingCount(): number; /** Clears all queued operations */ clear(): void; } //# sourceMappingURL=rate-limiter-adapter.d.ts.map