public void FileBufferWriteStreamFromAspNetCore() { using var writer = new FileBufferingWriteStream(memoryThreshold: MemoryThreshold); foreach (var chunk in GetChunks()) { writer.Write(chunk.Span); } writer.Flush(); using var ms = new MemoryStream(content.Length); writer.DrainBufferAsync(ms).GetAwaiter().GetResult(); }