首页 > 解决方案 > 如何在 Google Cloud Storage 中上传批量对象?

问题描述

我正在使用 Google Cloud Storage 和 Java,我需要将 1000 个对象批量上传到 GCS。

这是 GCS 提供的文档

Storage storage = StorageOptions.getDefaultInstance().getService();
BlobId blobId = BlobId.of("bucket", "blob_name");
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));

但它只适用于一个对象,我正在寻找一个批处理函数但我没有找到它,因此我必须使用 for 逐个对象上传对象。

标签: javagoogle-cloud-storage

解决方案


还没有。您可以在此处阅读有关现有积压功能请求的信息:https ://github.com/googleapis/google-cloud-java/issues/2351


推荐阅读