import { FileServiceImpl, createFileServiceModule } from './impls'; /** * 文件服务类 * 使用模块化实现方式,提供文件操作服务 */ export class FileService { private impl: FileServiceImpl = createFileServiceModule(); /** * 删除文件 */ public async deleteFile(key: string) { return this.impl.deleteFile(key); } /** * 批量删除文件 */ public async deleteFiles(keys: string[]) { return this.impl.deleteFiles(keys); } /** * 获取文件内容 */ public async getFileContent(key: string): Promise { return this.impl.getFileContent(key); } /** * 获取文件字节数组 */ public async getFileByteArray(key: string): Promise { return this.impl.getFileByteArray(key); } /** * 创建预签名上传URL */ public async createPreSignedUrl(key: string): Promise { return this.impl.createPreSignedUrl(key); } /** * 创建预签名预览URL */ public async createPreSignedUrlForPreview(key: string, expiresIn?: number): Promise { return this.impl.createPreSignedUrlForPreview(key, expiresIn); } /** * 上传内容 */ public async uploadContent(path: string, content: string) { return this.impl.uploadContent(path, content); } /** * 获取完整文件URL */ public async getFullFileUrl(url?: string | null, expiresIn?: number): Promise { return this.impl.getFullFileUrl(url, expiresIn); } }