Created
January 7, 2026 20:07
-
-
Save AnthonyGiretti/21023b6832fc8f0467fec99000d9c0f9 to your computer and use it in GitHub Desktop.
.NET 10 GZip concatenated read + better performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.IO.Compression; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| async Task ReadConcatenatedGzipAsync(string path) | |
| { | |
| await using var fileStream = File.OpenRead(path); | |
| await using var gzip = new GZipStream(fileStream, CompressionMode.Decompress); | |
| using var reader = new StreamReader(gzip, Encoding.UTF8); | |
| string content = await reader.ReadToEndAsync(); | |
| Console.WriteLine(content); | |
| } | |
| // Works even if the file contains multiple gzip members concatenated + better performance | |
| await ReadConcatenatedGzipAsync("data.gz"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment