如何在Windows中设置gsutil以从Firebase存储网络下载

时间:2019-02-12 18:09:23

标签: firebase google-cloud-platform firebase-storage gsutil

我有这种设置。用户上传文件并将下载URL放到Firestore

console.log("Upload Complete");
             task.snapshot.ref.getDownloadURL().then(function(downloadURL){
                 //to Firestore
             db.collection("user").doc("userFiles").collection('File').add({
                name: nameOfFile,
                url: downloadURL,
                dbTime: firebase.firestore.FieldValue.serverTimestamp(),
            })
            .then(function(docRef){ 
            console.log("Document written");
             })
            .catch(function(error){ console.error("Error:", error);

             });
              //end firestore   
         },

稍后会加载相关的UI,并应该使用一个下载按钮来下载文件。像在正常情况下一样,如果使用Web来存储计算机和电话,则使用Web来存储电话。 我得到的错误

Access to XMLHttpRequest at 'https://firebasestorage.googleapis.com/v0/b/all-writer.appspot.com/o/User%20Documents%2FeF1RFw3FVAO3LFJ8ORrf7oJPlt=media&token=fa017750-756c-4de6-9231-53da30304faa' from origin 'file://' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

要安装gsutil的官方Cloud SDK安装程序尝试安装到3/4,然后出现错误

Download failed: Timeout while connecting

我进行了其他手动安装。将gsutil放在C:中。安装了python。当我从cmd gsutil

运行it is not recognized as an operable program命令时

如何解决此问题并开始运行命令。 我的文件夹结构如下enter image description here

Python版本

Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

0 个答案:

没有答案