minio .net
personally I've used minIO for .net without any issue, potentially another option: https://min.io/docs/minio/linux/developers/dotnet/minio-dotnet.html
1 Reply
Example of using minIO in .net with c# to upload to r2
private MinioClient CreateClient(string accountId, string accessKey, string secretKey)
{
return new MinioClient()
.WithEndpoint($"{accountId}.r2.cloudflarestorage.com")
.WithCredentials(accessKey, secretKey)
.WithSSL(true)
.WithRegion("auto")
.Build();
}
public async Task UploadFile(string objectName, Stream value, string accountId, string accessKey, string secretKey, string bucketName, CancellationToken token)
{
var client = CreateClient(accountId, accessKey, secretKey);
PutObjectArgs putObjectArgs = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithStreamData(value)
.WithObjectSize(value.Length);
await client.PutObjectAsync(putObjectArgs, token);
}
private MinioClient CreateClient(string accountId, string accessKey, string secretKey)
{
return new MinioClient()
.WithEndpoint($"{accountId}.r2.cloudflarestorage.com")
.WithCredentials(accessKey, secretKey)
.WithSSL(true)
.WithRegion("auto")
.Build();
}
public async Task UploadFile(string objectName, Stream value, string accountId, string accessKey, string secretKey, string bucketName, CancellationToken token)
{
var client = CreateClient(accountId, accessKey, secretKey);
PutObjectArgs putObjectArgs = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithStreamData(value)
.WithObjectSize(value.Length);
await client.PutObjectAsync(putObjectArgs, token);
}