我想从Firebase存储中下载整个文件夹。单个文件可以通过如下获取DownloadURL来下载。但它对文件夹不起作用。
var storageRef = firebase.storage().ref();
// Create a reference to the file we want to download
var starsRef = storageRef.child(path);
// Get the download URL
starsRef.getDownloadURL().then(function(url) {
// Insert url into an <img> tag to "download"
ImageUrl = url;
console.log(ImageUrl);
}).catch(function(error) {
switch (error.code) {
case 'storage/object_not_found':
// File doesn't exist
break;
case 'storage/unauthorized':
// User doesn't have permission to access the object
break;
case 'storage/canceled':
// User canceled the upload
break;
case 'storage/unknown':
// Unknown error occurred, inspect the server response
break;
}
});
如何从Firebase下载整个文件夹?
答案 0 :(得分:11)
您可以使用gsutil下载整个存储分区
gsutil -m cp -R gs://<bucket_name> .
答案 1 :(得分:4)
答案 2 :(得分:1)
Command gustil Windows !!!
gsutil cp -r gs://<bucket_name>.appspot.com/OBJECT_NAME "D:\path"
为 PowerShell 使用云工具
安装窗口的参考 >> https://cloud.google.com/storage/docs/gsutil_install
答案 3 :(得分:0)
安装 gsutil -> Download Gsutill 然后在 CMD 或 Power shell 中运行以下命令
gsutil cp -m -r "Bucket URL(Start with gs://)" "destination folder(in computer)"