import type { HttpDownloadOptions, HttpDownloadResult } from './http-request';
export interface DownloadLockInfo {
    pid: number;
    startTime: number;
    url: string;
}
export interface DownloadWithLockOptions extends HttpDownloadOptions {
    /**
     * Maximum time to wait for lock acquisition in milliseconds.
     * @default 60000 (1 minute)
     */
    lockTimeout?: number | undefined;
    /**
     * Directory where lock files are stored.
     * @default '<destPath>.locks'
     */
    locksDir?: string | undefined;
    /**
     * Interval for checking stale locks in milliseconds.
     * @default 1000 (1 second)
     */
    pollInterval?: number | undefined;
    /**
     * Maximum age of a lock before it's considered stale in milliseconds.
     * Aligned with npm's npx locking strategy (5-10 seconds).
     * @default 10000 (10 seconds)
     */
    staleTimeout?: number | undefined;
}
/**
 * Download a file with locking to prevent concurrent downloads of the same resource.
 * If another process is already downloading to the same destination, this will wait
 * for the download to complete (up to lockTimeout) before proceeding.
 *
 * @throws {Error} When download fails or lock cannot be acquired.
 *
 * @example
 * ```typescript
 * const result = await downloadWithLock(
 *   'https://example.com/file.tar.gz',
 *   '/tmp/downloads/file.tar.gz',
 *   {
 *     retries: 3,
 *     lockTimeout: 60000, // Wait up to 1 minute for other downloads
 *   }
 * )
 * ```
 */
export declare function downloadWithLock(url: string, destPath: string, options?: DownloadWithLockOptions | undefined): Promise<HttpDownloadResult>;
