My aim is to GET and POST files to SP Online.
I have written a WEB API with the two methods. These methods use CSOM to interact with SP Online.
The GET returns the response Ok(array of bytes) to the client and the POST gets the entire file to upload in the request body and performs the upload to Sharepoint Online in chunks.
I've been told that i should use streaming techniques, since the context is an enterprise application with many simultaneous requests. So the GET method should return a stream to the client and the client should send the request as a stream to the POST.
In the client side i'm forced to use the RestSharp library.
So:
1) How to use RestSharp to deal with streams?
2) How can the WebAPI return a stream?
3) Along with the file i send a lot of metadata. How can i upload the file in streaming mode and send the metadata only once?
Client side, the get requires an array of bytes and the post sends an array of bytes along with metadata.
Online i've found too many techniques. Is there a standard one?