Skip to content

Instantly share code, notes, and snippets.

@richlander
Created May 7, 2018 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlander/ee710fe3dd9292f0273d39dc8ef28c8c to your computer and use it in GitHub Desktop.
Save richlander/ee710fe3dd9292f0273d39dc8ef28c8c to your computer and use it in GitHub Desktop.
Brotli Decompression
public static Stream DecompressWithBrotli(Stream toDecompress)
{
MemoryStream decompressedStream = new MemoryStream();
using (BrotliStream decompressionStream = new BrotliStream(toDecompress, CompressionMode.Decompress))
{
decompressionStream.CopyTo(decompressedFileStream);
}
return decompressedStream;
}
// Docs: https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.brotlistream?view=netcore-2.1
@JesperNoerregaard
Copy link

How does the data get into the variable decompressedStream when it is copied to the undeclared variable decompressedFileStream ?

@ianhays
Copy link

ianhays commented May 30, 2018

line 6 should be decompressionStream.CopyTo(decompressedStream);

@richlander
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment