파일을 삭제하려면 먼저 파일을 가리키는 참조를 만듭니다. 그런 다음 참조에 대해 delete() 메서드를 호출합니다. 정상적으로 처리되면 Promise가 반환되고 Promise가 거부되면 오류가 반환됩니다.
Web
import{getStorage,ref,deleteObject}from"firebase/storage";conststorage=getStorage();// Create a reference to the file to deleteconstdesertRef=ref(storage,'images/desert.jpg');// Delete the filedeleteObject(desertRef).then(()=>{// File deleted successfully}).catch((error)=>{// Uh-oh, an error occurred!});
// Create a reference to the file to deletevardesertRef=storageRef.child('images/desert.jpg');// Delete the filedesertRef.delete().then(()=>{// File deleted successfully}).catch((error)=>{// Uh-oh, an error occurred!});
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-11-21(UTC)"],[],[]]