Skip to content

Instantly share code, notes, and snippets.

@tombatron
Created December 31, 2012 01:22
Show Gist options
  • Save tombatron/4416637 to your computer and use it in GitHub Desktop.
Save tombatron/4416637 to your computer and use it in GitHub Desktop.
Decompress zlib'd data
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ionic.Zlib;
namespace TestZlib
{
class Program
{
static void Main(string[] args)
{
var tbl = new Invoice();
var rates = tbl.All(columns: "rates_json as Rates").First().Rates;
var output = new MemoryStream();
using (var compressedData = new MemoryStream(rates))
using (var decompressor = new ZlibStream(compressedData, CompressionMode.Decompress))
{
decompressor.CopyTo(output);
}
output.Position = 0;
var reader = new StreamReader(output);
Console.Write(reader.ReadToEnd());
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment