Quantcast
Channel: sharpcompress Discussions Rss Feed
Viewing all articles
Browse latest Browse all 239

New Post: Reading GZIP file 'on the fly'

$
0
0
Lets say I'm making an HttpWebRequest for a gzip file out on a remote server. How do I stream that through SharpCompress so that I can write the content to disk (or to some other output stream)?

I tried a simple test like this:
       GZipStream gzs = new GZipStream(myHttpStream, CompressionMode.Decompress);

        byte[] buffer = new byte[1024];
        int read;
        while ((read = gzs.Read(buffer, 0, buffer.Length)) > 0) {
            myWriter.Write(buffer, 0, read);
        }
        myWriter.Flush();

        gzs.Close();
It reads just the first row of the file and that's it. What am I doing wrong here? I'd really like to be able to stream it through this code without having to physically download the file first. Thanks

Viewing all articles
Browse latest Browse all 239

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>