LoginSignup
1
0

More than 1 year has passed since last update.

Cloud Storage for Firebase フォルダごと削除する

Posted at

方法

現状フォルダごと削除する機能はないので、リストを取得してループを回す。
フォルダ配下のファイルがすべて消えるとフォルダも削除される。

// 削除するフォルダへの参照を作成
var listRef = storageRef.child('files/uid');

// フォルダ配下のアイテムをすべて取得
listRef.listAll().then( (res) => {
  res.items.forEach( (itemRef) =>  {
    // 削除
    itemRef.delete()
  });

参考

https://firebase.google.com/docs/storage/web/delete-files?hl=ja
https://firebase.google.com/docs/storage/web/list-files?hl=ja

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0