Currently my app returns data by MemoryStream
, the problem is
the size of data could be large than 500MB, and that takes up much memory before return.
I am seeking for a way to return the data progressively. For example, flush the output for every 1MB.
First I tried IPartialWriter
public class ViewRenderResult : IPartialWriter
{
public void WritePartialTo(IResponse response)
{
response.Write("XXX");
}
public bool IsPartialRequest { get { return true; } }
}
response.Write
can only be called for one time.
Then I found IStreamWriter
public interface IStreamWriter
{
void WriteTo(Stream responseStream);
}
I doubt it caches all data before returining.
Please can anyone clarify it?