Home > Enterprise >  Limit the use of bandwith for the download using httpclient
Limit the use of bandwith for the download using httpclient

Time:09-27

I have a question about file downloads. I would like to understand how large file downloads work in .Net HttpClient.

Lets say I have file of size 1GB. When I send a HTTP GET request to download the file from a HttpClient, using HttpClient.GetStreamAsync method, does it retrieve the response body (byte by byte) as I read or does it retrieves the full response as and buffer on the client?

I'm asking this because I want to understand if I can limit the use of bandwith for the download on the client.

Thanks.

CodePudding user response:

No sir, its not possible I think, But you can use HttpClient.Timeout.

CodePudding user response:

If you can get the size of the file that you are downloading before the download begins. you can add a condition based on your bandwidth limit if the client can download this file or not.

  • Related