Skip to content

Commit e41a174

Browse files
committed
Implement Delete Function
1 parent ba03e52 commit e41a174

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/firebase.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ export default class FirebaseStorageAdapter extends BaseAdapter {
6868
};
6969
}
7070

71-
delete(fileName: string, targetDir: string): Promise<boolean> {
72-
return this.bucket
73-
.file(join(targetDir, fileName))
74-
.exists()
75-
.then(() => true);
71+
async delete(fileName: string): Promise<boolean> {
72+
const targetDirectory = this.getTargetDir(this.basePath);
73+
const results = await this.bucket.file(join(targetDirectory, fileName)).delete();
74+
if (results[0].statusCode === 200) {
75+
return true;
76+
}
77+
return false;
7678
}
7779

7880
read(options?: ReadOptions): Promise<Buffer> {

0 commit comments

Comments
 (0)