You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Minio;
using Minio.DataModel.Args;
var endpoint = "127.0.0.1:9000";
var accessKey = "lkk";
var secretKey = "lkk123";
var secure = false;
// Initialize the client with access credentials.
IMinioClient minio = new MinioClient()
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)
.WithSSL(secure)
.Build();
var BucketName = "gamedata";
try {
Console.WriteLine("Running example for API: CopyObjectAsync");
var metaData = new Dictionary<string, string>
(StringComparer.Ordinal) { { "Test-Metadata", "Test Test" } };
// Optionally pass copy conditions
var guidSave = Guid.NewGuid().ToString();
var saveObjectName = "copy/" + guidSave;
File.WriteAllBytes("test.txt", new byte[1024 * 1024]);
var filestream = File.OpenRead("test.txt");
var putargs = new PutObjectArgs()
.WithBucket(BucketName)
.WithObject(saveObjectName)
.WithStreamData(filestream)
.WithObjectSize(filestream.Length)
.WithContentType("application/octet-stream")
.WithHeaders(metaData);
_ = await minio.PutObjectAsync(putargs).ConfigureAwait(false);
var cpSrcArgs = new CopySourceObjectArgs()
.WithBucket(BucketName)
.WithObject(saveObjectName);
for (int i = 0; i < 500000; i++) {
var guid = Guid.NewGuid().ToString();
var destObjectName = "copy/" + guid;
var copyargs = new CopyObjectArgs()
.WithBucket(BucketName)
.WithObject(destObjectName)
.WithCopyObjectSource(cpSrcArgs);
await minio.CopyObjectAsync(copyargs).ConfigureAwait(false);
Console.WriteLine("Copied object {0} from {1} to {2}", i, saveObjectName,destObjectName);
Console.WriteLine();
}
} catch (Exception e) {
Console.WriteLine("[Bucket] Exception: {0}", e);
}
environment
simple demo just for test copy
demo environment
The text was updated successfully, but these errors were encountered: