Decompressing GZip Json String into normal Json String in Angularjs+Typescript
<p>Our application is built in Angularjs, In one scenario We are sending good amount of JSON data to client side. So it take much time. So What we have done now, we make that JSON data as GZIP string.</p>

<pre><code> public static string Compress(string s)
    {
        var bytes = Encoding.Unicode.GetBytes(s);
        using (var msi = new MemoryStream(bytes))
        using (var mso = new MemoryStream())
        {
            using (var gs = new GZipStream(mso, CompressionMode.Compress))
            {
                msi.CopyTo(gs);
            }
            return Convert.ToBase64String(mso.ToArray());
        }
    } 
</code></pre>

<p>After using above code our string size reduced to good extent.
But now our problem is that we are unable to decompress that GZIP in client side.</p>

<p>I have tried following library,</p>

<p><a href="https://github.com/imaya/zlib.js" rel="nofollow">GZIP Library ZLIB</a></p>

<p>but still As we are using TypeScript, we dont get method accessible in page,</p>

<pre><code> var gunzip = new Zlib.Gunzip(bytes);
        var plain = gunzip.decompress(); 
</code></pre>

<p>In above line <strong>Zlib</strong> is not available. May be due to TypeScript definition not available for same.</p>

<p>So can anyone help me to decompress above Gzip string.</p>