@typecad/jlcpcb-parts
Version:
Intelligent fuzzy search for JLCPCB electrical components with CLI interface
46 lines • 1.78 kB
TypeScript
/**
* Handles downloading CSV files from remote URLs with retry logic.
* Supports both shared cache directory and custom path modes.
*/
export declare class CsvDownloader {
private readonly maxRetries;
private readonly initialBackoffMs;
private readonly useSharedCache;
private readonly customCacheDir;
/**
* Creates a new CSV downloader
* @param maxRetries Maximum number of retry attempts (default: 3)
* @param initialBackoffMs Initial backoff time in milliseconds (default: 1000)
* @param useSharedCache Whether to use shared cache directory (default: true)
* @param customCacheDir Custom cache directory (used when useSharedCache is false)
*/
constructor(maxRetries?: number, initialBackoffMs?: number, useSharedCache?: boolean, customCacheDir?: string);
/**
* Downloads a CSV file from a URL with retry logic
* @param url URL to download the CSV from
* @param fileName Name of the file to save (will be resolved to appropriate cache directory)
* @returns Promise that resolves when download is complete
* @throws NetworkError if download fails after all retries
*/
downloadCsv(url: string, fileName: string): Promise<void>;
/**
* Performs the actual download operation
* @param url URL to download from
* @param outputPath Path to save the file
* @private
*/
private performDownload;
/**
* Validates that the downloaded CSV file is complete and valid
* @param filePath Path to the CSV file
* @private
*/
private validateCsvFile;
/**
* Simple delay function for implementing backoff
* @param ms Milliseconds to delay
* @private
*/
private delay;
}
//# sourceMappingURL=CsvDownloader.d.ts.map