Upload a file to Google Cloud, in a specific directory

前端 未结 6 1733
借酒劲吻你
借酒劲吻你 2021-02-04 04:31

How to upload a file on Google Cloud, in a specific bucket directory (e.g. foo)?

\"use strict\";

const gcloud = require(\"gcloud\");

const PROJECT         


        
6条回答
  •  Happy的楠姐
    2021-02-04 05:14

    bucket.upload("1.jpg", { destination: "YOUR_FOLDER_NAME_HERE/1.jpg" }, (err, file) => {
        //Do something...
    });
    

    This will put 1.jpg in the YOUR_FOLDER_NAME_HERE-folder.

    Here is the documentation. By the way, gcloud is deprecated and you should use google-cloud instead.

提交回复
热议问题