@takentrade/takentrade-libs
Version:
TakeNTrade shared libraries
22 lines (21 loc) • 986 B
TypeScript
import { IStorageService, UploadResponse, DeleteResponse, FileUpload } from './storage.interface';
export declare class StorageService implements IStorageService {
/**
* Uploads a file to Cloudinary using a stream.
* @param file - The file to upload, provided as a FileUpload object.
* @param options - Optional Cloudinary upload options (e.g., folder, tags).
* @returns A promise resolving to the upload response containing file details.
* @throws Error if the upload fails or no result is returned from Cloudinary.
*/
uploadFile(file: FileUpload, options?: {
folder?: string;
tags?: string[];
}): Promise<UploadResponse>;
/**
* Deletes a file from Cloudinary using its public ID.
* @param publicId - The public ID of the file to delete.
* @returns A promise resolving to the deletion response.
* @throws Error if the deletion fails.
*/
deleteFile(publicId: string): Promise<DeleteResponse>;
}