/// import { type ReadableStream as WebReadableStream } from 'node:stream/web'; import { APIResource } from '../resource'; /** * 临时下载码 * * @see https://open.dingtalk.com/document/orgapp/download-the-file-content-of-the-robot-receiving-message */ export type DownloadCode = string; export declare class Downloader extends APIResource { endpoint: string; /** * 使用下载码交换文件地址 * * @param downloadCode - 下载码 * @param robotCode - 机器人Code */ exchangeCode(downloadCode: DownloadCode, robotCode?: string): Promise; /** * 下载文件到指定位置 * * @param url - 下载地址 * @param filePath - 文件路径 * @returns 文件路径 */ downloadToPath(url: string, filePath: string): Promise; /** * 下载文件到临时目录 * * @param url - 下载地址 * @param filename - 文件名 * @returns 临时文件路径 */ downloadToTmp(url: string, name?: string): Promise; protected fetchStream(url: string): Promise; /** * 保存数据流到文件 * * @param stream - 数据流 * @param filePath - 绝对路径 * @returns 文件路径 */ protected saveTo(stream: WebReadableStream, filePath: string): Promise; }