Skip to content

Commit

Permalink
Added delete functionality in cloudinary
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatdwi176 committed Feb 3, 2024
1 parent 31d315d commit 0b65cfe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/utils/cloudinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@ const uploadOnCloudinary = async (localFilePath) => {
fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed
return null;
}


}

const deleteFile = async (publicid) => {
try {
if (!publicid) return "Public id not found";
const deletresponse = await cloudinary.uploader.destroy(publicid, {
resource_type: "video",
});
return deletresponse;
} catch (e) {
return e.message;
}
};


export {uploadOnCloudinary}
export {uploadOnCloudinary, deleteFile}

0 comments on commit 0b65cfe

Please sign in to comment.