mira-app-server
Version:
Mira Server - standalone server application using mira-app-core
33 lines • 1.11 kB
TypeScript
import type { MiraServer } from '../';
export interface DownloadTaskInput {
url: string;
libraryId: string;
userId: number;
folderId?: number | null;
clientId?: string | null;
}
export interface BatchProgress {
batchId: string;
total: number;
completed: number;
failed: number;
skipped: number;
done: boolean;
}
export declare class DownloadExecutorService {
private readonly queue;
private readonly progress;
private readonly backend;
constructor(backend: MiraServer);
/** 拿 UserStorage(通过 httpServer.authRouter) */
private getUserStorage;
/** 入队一批下载任务,返回 batchId */
enqueueBatch(tasks: DownloadTaskInput[]): Promise<string>;
getProgress(batchId: string): BatchProgress | null;
private runOne;
/** 按 host 匹配该用户的 cookie 组:is_default 优先,否则该 url 第一组。返回 "a=b; c=d" 或空串 */
private matchCookieHeader;
/** 从 URL 猜测文件名,失败则用占位名 */
private guessFilename;
}
//# sourceMappingURL=DownloadExecutorService.d.ts.map