UNPKG

payload-cloudinary

Version:
14 lines 507 B
import path from 'path'; export const getHandleDelete = ({ cloudinary, folder }) => async ({ filename }) => { const filePath = path.posix.join(folder, filename); try { // Extract public_id without file extension const publicId = filePath.replace(/\.[^/.]+$/, ''); await cloudinary.uploader.destroy(publicId); } catch (error) { console.error('Error deleting file from Cloudinary:', error); throw error; } }; //# sourceMappingURL=handleDelete.js.map