title: Copy data from writer Stream to reader Stream
body: <p>Given two external APIs with one offering a download API and the other offering an upload API, both only allow using a <code>Stream</code> for data exchange, I need a way to efficiently transfer the data directly from download straight to upload.</p>
  
  <p>Assume the APIs are as simple as:</p>
  
  <p><code>Download (string url, Stream stream)</code></p>
  
  <p><code>Upload (string url, Stream source)</code></p>
  
  <p>I can't find a <code>Stream</code> implementation in the .NET framework that offers this capability.</p>
  
  <p>This is not a case for <code>Stream.CopyTo</code> as both APIs implement their own read and write IO loops. If either of the APIs had returned a custom <code>Stream</code> implementation then <code>Stream.CopyTo</code> would be the answer, but since they both accept an input <code>Stream</code> for reading or writing, one has to implement a custom <code>Stream</code> that acts as both a sink (for the downloader) and a source (for the uploader) and puts back-pressure on the slower of the two to keep memory buffers from growing out of control.</p>