I found an issue when we use the DownloadFileAsync method. Since it uses IRequest.AsStream(), this method invokes HttpClient.SendAsync(request, cancellationtoken) and than HttpResponseMessage.Content.ReadAsStreamAsync() for the response message.
The HttpResponseMessage.Content.ReadAsStreamAsync() read whole content into the memory buffer and makes the stream from result buffer.
In our project we encountered with following issue: if we receive a large enough file, buffer can overflow.
But I also found (here Streaming Large HTTP Responses) if we call HttpClient.SendAsync with HttpCompletionOption.ResponseHeadersRead flag it just return stream without buffering and we can handle received stream as we want.
So I suggest to use old implementation of DownloadFileAsync in new method, but with HttpCompletionOption.ResponseHeadersRead flag.
May we also need to create issue in Pathoschild repository.
I found an issue when we use the DownloadFileAsync method. Since it uses IRequest.AsStream(), this method invokes HttpClient.SendAsync(request, cancellationtoken) and than HttpResponseMessage.Content.ReadAsStreamAsync() for the response message. The HttpResponseMessage.Content.ReadAsStreamAsync() read whole content into the memory buffer and makes the stream from result buffer.
In our project we encountered with following issue: if we receive a large enough file, buffer can overflow.
But I also found (here Streaming Large HTTP Responses) if we call HttpClient.SendAsync with HttpCompletionOption.ResponseHeadersRead flag it just return stream without buffering and we can handle received stream as we want.
So I suggest to use old implementation of DownloadFileAsync in new method, but with HttpCompletionOption.ResponseHeadersRead flag.
May we also need to create issue in Pathoschild repository.