@xuanqikai/one-click-upload
Version:
A CLI tool for one-click file upload to cloud storage services (OSS, TOS)
97 lines • 2.66 kB
TypeScript
import { ProgressCallback, UploadResult } from "../types";
import { BaseUploader } from "./BaseUploader";
export declare class OSSUploader extends BaseUploader {
private client;
private cdnService?;
constructor(config: any);
/**
* 初始化 OSS 客户端
*/
private initializeClient;
/**
* 初始化 CDN 刷新服务
*/
private initializeCDNService;
/**
* 上传单个文件
*/
protected uploadSingleFile(localPath: string, remotePath: string, options?: {
overwrite?: boolean;
enableResume?: boolean;
maxRetries?: number;
chunkSize?: number;
onProgress?: ProgressCallback;
customCacheControl?: string;
}): Promise<UploadResult>;
/**
* 验证配置
*/
validateConfig(): Promise<boolean>;
/**
* 刷新 CDN 缓存(目录)
*/
refreshCDNDirectory(remoteDirPath: string): Promise<boolean>;
/**
* 检查文件是否存在
*/
fileExists(remotePath: string): Promise<boolean>;
/**
* 获取文件信息
*/
getFileInfo(remotePath: string): Promise<any>;
/**
* 删除文件
*/
deleteFile(remotePath: string): Promise<boolean>;
/**
* 列出文件
*/
listFiles(prefix?: string, maxKeys?: number): Promise<any[]>;
/**
* 查询 CDN 刷新任务状态
*/
getCDNRefreshTaskStatus(taskId: string): Promise<any>;
/**
* 查询 CDN 刷新配额
*/
getCDNRefreshQuota(): Promise<any>;
/**
* 刷新 CDN 缓存(单个文件)
*/
refreshCDNCache(remotePath: string): Promise<boolean>;
/**
* 批量刷新 CDN 缓存
*/
refreshCDNCacheBatch(remotePaths: string[]): Promise<{
success: number;
failed: number;
}>;
/**
* 预热 CDN 缓存(单个文件)
*/
preloadCDNCache(remotePath: string, options?: {
area?: "domestic" | "overseas";
l2Preload?: boolean;
withHeader?: Record<string, string[]>;
queryHashkey?: boolean;
consistencyHash?: boolean;
}): Promise<boolean>;
/**
* 批量预热 CDN 缓存(多个文件)
*/
preloadCDNCacheBatch(remotePaths: string[], options?: {
area?: "domestic" | "overseas";
l2Preload?: boolean;
withHeader?: Record<string, string[]>;
queryHashkey?: boolean;
consistencyHash?: boolean;
}): Promise<{
success: number;
failed: number;
}>;
/**
* 检查是否启用了 CDN 自动刷新
*/
isCDNAutoRefreshEnabled(): boolean;
}
//# sourceMappingURL=OSSUploader.d.ts.map