import { Photo } from '@puregram/api'; import type { TelegramFile, TelegramPhotoSize } from '@puregram/api'; import type { HttpClient } from '../http/client.js'; import type { MediaSourceFileId } from '../media-source/index.js'; import type { ResolvedTelegramOptions } from '../options.js'; /** * any value resolvable to a telegram file URL — raw `file_id`, `MediaSource.fileId(...)`, * any wrapper with `fileId`, any payload with `file_id`, or `Photo` / `TelegramPhotoSize[]` * (largest auto-picked). other `MediaSource.X(...)` upload variants throw `TypeError` */ export type DownloadTarget = string | MediaSourceFileId | { file_id: string; file_path?: string | undefined; } | { fileId: string; filePath?: string | undefined; } | Photo | TelegramPhotoSize[]; interface ResolvedTarget { fileId: string; filePath?: string; } interface DownloadDeps { options: ResolvedTelegramOptions; httpClient: HttpClient; getFile: (fileId: string) => Promise; } /** resolve any supported target shape into `{fileId, filePath?}` */ export declare function resolveDownloadTarget(target: DownloadTarget): ResolvedTarget; /** build the public download URL — resolves `file_path` via `getFile` when the target didn't carry one */ export declare function getFileURL(deps: DownloadDeps, target: DownloadTarget): Promise; /** download into a `Buffer` (most common case) */ export declare function download(deps: DownloadDeps, target: DownloadTarget): Promise>; /** download as a node `Readable` stream */ export declare function downloadStream(deps: DownloadDeps, target: DownloadTarget): Promise; /** download as an async-iterable byte stream (zero buffering) */ export declare function downloadIterable(deps: DownloadDeps, target: DownloadTarget): Promise>>; /** download and write straight to disk */ export declare function downloadToFile(deps: DownloadDeps, path: string, target: DownloadTarget): Promise; export {}; //# sourceMappingURL=download.d.ts.map