question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Download large files

See original GitHub issue

When using async semantics to get a large file, the whole file must be read into RAM, also blocking a thread. This is especially an issue in a server environment.

One might expect the following to work:

    IO::Stream stream;
	
    await m_client.GetObjectAsync(this.m_bucket,
                path,
                s => stream = s,
                cancellationToken);
	
    await data = stream.read() ...

However that fails because the stream “s” must be consumed inside the stream callback. This is because RestSharp closes the request immediately after calling the callback. There is actually a closed issue over there on that:

https://github.com/restsharp/RestSharp/issues/539

While that may be an “edge case” for RestSharp, it is clearly an issue here where we could easily be dealing with large files. The only way to read a file is as in the example:

    IO::MemoryStream stream;
	
    await m_client.GetObjectAsync(this.m_bucket,
                path,
                s => s.CopyTo(stream),
                cancellationToken);
	
    data = stream.read() ...

However, that uses much RAM and blocks a thread in the threadpool when being run in a service.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
KyleGobelcommented, Feb 3, 2020

Is this still planned? I thought it was strange when I first saw to access the stream you had to provide a callback, i guess that’s just because of RestSharp?

IMO this makes the client library pretty limiting.

5reactions
ptr1120commented, Aug 10, 2019

Please consider to reopen this issue, because for the minio main use case it seems to have a high priority to support downloading files async and be able to stream files without loading the whole content into memory. A closed issue does not support improving this in near future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test File Download | 10GB, 5GB, 1GB, 512MB, 200MB ...
Here to test file download of 10Gb, 5GB, 1GB, 512MB, 200MB, 100MB, 50MB, 20MB, 10MB, 5MB, 1MB, or 100KB. Test downloading speed in...
Read more >
Download Test Files
We suggest only testing the large files if you have a connection speed faster than 10 Mbps. Click the file you want to...
Read more >
Download & Generate Test Files - Fastest Fish
Download test files of any size. Including 1GB, 2GB, 5GB, 10GB or generate a file of any size. Download over the network or...
Read more >
Download Test Files
Download Test Files ; Very Large File 1 GB (1,024 MB) · Port: 80, 81, FTP: ftp ; Large File 0.5 GB (512...
Read more >
how to download very large files in chrome
Append disk-cache-dir="F:\destination" to the target field of the Chrome shortcut · Start Chrome · Under Chrome > Settings > Advanced > Downloads ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found