改成内存流测试
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
c8d181e557
commit
5a27fbc127
|
|
@ -535,32 +535,37 @@ public class OSSService : IOSSService
|
|||
.WithSSL(minIOConfig.UseSSL)
|
||||
.Build();
|
||||
|
||||
var pipe = new System.IO.Pipelines.Pipe();
|
||||
#region 废弃3
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var args = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(async source =>
|
||||
{
|
||||
await source.CopyToAsync(pipe.Writer.AsStream());
|
||||
await pipe.Writer.FlushAsync();
|
||||
});
|
||||
//var pipe = new System.IO.Pipelines.Pipe();
|
||||
|
||||
//_ = Task.Run(async () =>
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var args = new GetObjectArgs()
|
||||
// .WithBucket(minIOConfig.BucketName)
|
||||
// .WithObject(ossRelativePath)
|
||||
// .WithCallbackStream(async source =>
|
||||
// {
|
||||
// await source.CopyToAsync(pipe.Writer.AsStream());
|
||||
// await pipe.Writer.FlushAsync();
|
||||
// });
|
||||
|
||||
// await minioClient.GetObjectAsync(args);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// await pipe.Writer.CompleteAsync();
|
||||
// }
|
||||
//});
|
||||
|
||||
//return pipe.Reader.AsStream();
|
||||
|
||||
#endregion
|
||||
|
||||
await minioClient.GetObjectAsync(args);
|
||||
}
|
||||
finally
|
||||
{
|
||||
await pipe.Writer.CompleteAsync();
|
||||
}
|
||||
});
|
||||
|
||||
return pipe.Reader.AsStream();
|
||||
|
||||
|
||||
#region 废弃2
|
||||
|
||||
//var pipe = new System.IO.Pipelines.Pipe();
|
||||
|
|
@ -594,16 +599,16 @@ public class OSSService : IOSSService
|
|||
|
||||
#region 废弃
|
||||
|
||||
//var memoryStream = new MemoryStream();
|
||||
var memoryStream = new MemoryStream();
|
||||
|
||||
//var getObjectArgs = new GetObjectArgs()
|
||||
// .WithBucket(minIOConfig.BucketName)
|
||||
// .WithObject(ossRelativePath)
|
||||
// .WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
|
||||
var getObjectArgs = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
|
||||
|
||||
//await minioClient.GetObjectAsync(getObjectArgs);
|
||||
//memoryStream.Position = 0;
|
||||
//return memoryStream;
|
||||
await minioClient.GetObjectAsync(getObjectArgs);
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue