RestSharp is loading the whole file into memory when uploading. How to avoid it?
Use the AddFile(name, writer, filename)
overload.
For the writer
parameter, pass an Action<Stream>
that writes directly to the request body stream. Do not close the stream.
Here's an example for writing to the stream.
And I gave up after I found this line, so request bodies are always loaded into memory, which is unfortunate, so I built a simple solution to do file uploads based on code from this question and from debugging the Apache HttpClient library.
In case someone is interested, the source is available here.