【问题标题】:Creating buckets with Google Cloud Storage + Node.js使用 Google Cloud Storage + Node.js 创建存储桶
【发布时间】:2014-07-21 23:08:35
【问题描述】:

我希望能够在 Google Cloud Storage 中动态创建存储分区。我正在使用 MEAN.io 堆栈,因此我想在后端的 Node.js 中执行此操作。 我无法找到帮助我的 api,有没有办法做到这一点?

谢谢!

更新:在这里我尝试使用 Google-Node.js api,但没有任何反应。然后我尝试对其进行身份验证,以防出现问题,但我不确定从这里去哪里。

googleAuth.authenticate(
    credentials.jwt,
    function(err, token) {
        if (err) console.log(err);
        console.log(token);

        googleapis
            .discover('storage', 'v1')
            .execute(function(err, client) {
                if (err) console.log(err);

                client.storage.buckets.insert({'project': credentials.project}, {'name': bucketname}).execute();
            })
    }); 

【问题讨论】:

    标签: node.js google-cloud-storage


    【解决方案1】:

    Google Cloud Storage JSON API 可能是您要使用的 API。您可以直接针对它编写代码,也可以使用 Google APIs Node.js Client 之类的库。

    【讨论】:

    • 我尝试使用 Google APIs Node.js 客户端,没有记录任何错误,但也没有发生任何事情。我正在更新我的问题以显示我正在尝试的代码 - 为什么这不会做任何事情?
    猜你喜欢
    • 2015-02-15
    • 1970-01-01
    • 1970-01-01
    • 2018-06-18
    • 1970-01-01
    • 2014-10-09
    • 1970-01-01
    • 1970-01-01
    • 2021-03-06
    相关资源
    最近更新 更多