using System.IO.Pipelines;
Pipe pipe = new(new(System.Buffers.MemoryPool<byte>.Shared));
HttpClient client = new();
var response = await client.GetAsync("http://example.com");
var memory = (await response.Content.ReadAsByteArrayAsync()).AsMemory();
for (int i = 0; i < 110; i++)
var pipeMemory = pipe.Writer.GetMemory(memory.Length);
memory.CopyTo(pipeMemory);
Console.WriteLine($"advancing {memory.Length}");
pipe.Writer.Advance(memory.Length);
Console.WriteLine("flushing");
await pipe.Writer.FlushAsync();
Console.WriteLine("finished flushing");
var result = await pipe.Reader.ReadAsync();
foreach (var bufferMemory in result.Buffer)
Console.Write(System.Text.Encoding.UTF8.GetString(bufferMemory.Span));
pipe.Reader.AdvanceTo(result.Buffer.End);