0

I am trying to copy data selectively from one Minio server to another with a c# windows application.
Data is downloaded OK, no exceptions occur, but file size in destination server is zero.
A little bit simplified, my source code is something as follows:

await source_client.GetObjectAsync("bucket", "path/from/file", async (stream) =>
{
    using (MemoryStream memoryStream = new MemoryStream())
    {
        memoryStream.Position = 0;
        await stream.CopyToAsync(memoryStream);
        await destintation_client.PutObjectAsync("bucket", "path/to/file", memoryStream,  memoryStream.Length);
    }

});

I use the MemoryStream to buffer all data downloaded from source server in memory before uploading it to destination server.
I have checked with a breakpoint that data is downloaded correctly and that memoryStream.Length is not zero.
Both servers are tested and work correctly.
However, after the process, I see that destination server has the desired number of files, but all with zero size.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • Hi, I have landed in the same situation. Unable to find any solution. Were you able to resolve this? – CrazyCoder Mar 30 '21 at 09:39
  • Hi @CrazyCoder. I could't get to work `CopyToAsync`, however it works OK with the sychronous version `CopyTo`. It appears not being properly awaited.... – José Bonadero Mar 31 '21 at 12:00

0 Answers0