node.js - 使用 Google Cloud Storage + Node.js 创建存储桶

标签 node.js google-cloud-storage

我希望能够在 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();
            })
    }); 

最佳答案

Google Cloud Storage JSON API可能是您想要使用的 API。您可以直接针对它进行编码,也可以使用像 Google APIs Node.js Client 这样的库。 .

关于node.js - 使用 Google Cloud Storage + Node.js 创建存储桶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24827457/

相关文章:

javascript - 为什么我的不和谐机器人无法正常上线?

python - 如果我在 MapReduce 作业结束时清理 Google 存储,为什么 BigQuery 不更新?

google-app-engine - Google 云存储客户端库 - 将 acl 设置为 "public-read"和 "bucket-owner-full-control"

java - 使用 Java 从 Google Storage 下载文件

node.js - create-react-app > 错误 css-loader@1.0.0 : The engine "node" is incompatible with this module. 预期版本 ">= 6.9.0 <7.0.0 || >= 8.9.0"

node.js - 身份验证策略 'jwt'未注册

node.js - node.js 是否保留异步执行顺序?

node.js - Meteor 中的后台工作人员和 REST 服务

java - 复制云存储文件(创建文件的副本)

google-cloud-platform - Google Cloud SQL 导入 - 错误 : HTTPError 403: The client is not authorized to make this request