我希望能够在 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/