@xuanqikai/one-click-upload
Version:
A CLI tool for one-click file upload to cloud storage services (OSS, TOS)
91 lines • 2.21 kB
TypeScript
export declare enum ServiceType {
OSS = "oss",
TOS = "tos"
}
export interface UploadProgress {
loaded: number;
total: number;
percentage: number;
fileName: string;
}
export interface UploadResult {
success: boolean;
fileName: string;
localPath: string;
remotePath: string;
url?: string;
error?: string;
size?: number;
}
export interface BatchUploadResult {
totalFiles: number;
successCount: number;
failedCount: number;
results: UploadResult[];
totalSize: number;
duration: number;
}
export interface OSSConfig {
region: string;
accessKeyId: string;
accessKeySecret: string;
bucket: string;
endpoint?: string;
}
export interface TOSConfig {
region: string;
accessKeyId: string;
accessKeySecret: string;
bucket: string;
endpoint?: string;
}
export interface ServiceConfig {
name: string;
type: ServiceType;
config: OSSConfig | TOSConfig;
isDefault?: boolean;
}
export interface GlobalConfig {
services: ServiceConfig[];
defaultService?: string;
}
export interface UploadOptions {
serviceName: string;
localPath: string;
remotePath: string;
overwrite?: boolean;
enableResume?: boolean;
maxRetries?: number;
chunkSize?: number;
contentsOnly?: boolean;
customCacheControl?: string;
}
export type ProgressCallback = (progress: UploadProgress) => void;
export interface IUploader {
upload(localPath: string, remotePath: string, options?: {
overwrite?: boolean;
enableResume?: boolean;
maxRetries?: number;
chunkSize?: number;
onProgress?: ProgressCallback;
}): Promise<UploadResult>;
uploadBatch(files: Array<{
localPath: string;
remotePath: string;
}>, options?: {
overwrite?: boolean;
enableResume?: boolean;
maxRetries?: number;
chunkSize?: number;
onProgress?: ProgressCallback;
}): Promise<BatchUploadResult>;
validateConfig(): Promise<boolean>;
}
export interface FileInfo {
path: string;
name: string;
size: number;
isDirectory: boolean;
relativePath: string;
}
//# sourceMappingURL=index.d.ts.map