qc-ui-lit 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DownloadOptions {
|
|
2
|
+
/** 下载文件名,不传则从 URL 自动提取 */
|
|
3
|
+
filename?: string;
|
|
4
|
+
/** 是否通过 fetch 转 Blob 下载(用于跨域或需要鉴权的资源),默认 false */
|
|
5
|
+
fetch?: boolean;
|
|
6
|
+
/** 请求头(仅在 fetch 为 true 时生效) */
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
/** fetch 请求凭证(如 cookie),仅在 fetch 为 true 时生效 */
|
|
9
|
+
credentials?: RequestCredentials;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 下载 URL 对应的文件
|
|
13
|
+
* @param url 文件地址
|
|
14
|
+
* @param options 配置项
|
|
15
|
+
* @returns Promise<void>
|
|
16
|
+
*/
|
|
17
|
+
export declare function downloadFile(url: string, options?: DownloadOptions): Promise<void>;
|
|
18
|
+
export default downloadFile;
|