c# - 如何使用 C# 检查 Google Cloud Storage 中是否存在对象?
问题描述
有谁知道如何通过 C# 检查 Google Cloud Storage 存储桶中是否存在对象?
解决方案
您可以使用 Google.Cloud.Storage.V1库
using Google.Cloud.Storage.V1;
public class StorageClass
{
public bool IsObjectExist(string bucketName, string objectname)
{
var client = StorageClient.Create();
return client.GetObject(bucketName, objectname) != null ? true : false;
}
}
推荐阅读
- c# - C# expando 从 JSON 创建并针对链接类模型进行有效性检查
- python - PIL、numpy 和 matplotlib 生成的绘图与原始图像的颜色大不相同
- pandas - TypeError:字段客户:无法合并类型
和 - bash - BASH:使用自定义变量更新 PATH
- php - 如何上传文件并用文件类型命名?
- bash - 如何自定义 bash 将哪些模式视为“隐藏”文件/目录
- google-api - YouTube 搜索 API 不过滤可嵌入/可联合的视频
- python - 在python中分配计数器时递增计数器
- html - 水平对齐两个元素
- html - 我遇到的一些页脚问题