"Amit Dedhia" <amitdedhia@yahoo.com> wrote in message
news:1182409936.258284.44200@i38g2000prf.googlegroups.com...
> Is there any way?
http://www.chilkatsoft.com/zip-dotnet.asp
--
http://www.markrae.net
This is a discussion on File compression in .NET - for very large files - DOTNET ; Hi I want to compress and decomress files. There is GZipStream class in .Net. However this class requires to allocate buffer equal to the file length to zip it (at least all sample code I saw were like that). The ...
Hi
I want to compress and decomress files. There is GZipStream class
in .Net. However this class requires to allocate buffer equal to the
file length to zip it (at least all sample code I saw were like that).
The file size in my case can be really very large and hence I want
something which does not require to load entire file in memory. Is
there any way?
Thanks and best regards
Amit Dedhia
"Amit Dedhia" <amitdedhia@yahoo.com> wrote in message
news:1182409936.258284.44200@i38g2000prf.googlegroups.com...
> Is there any way?
http://www.chilkatsoft.com/zip-dotnet.asp
--
http://www.markrae.net
On Jun 21, 8:12 am, Amit Dedhia <amitded...@yahoo.com> wrote:
> I want to compress and decomress files. There is GZipStream class
> in .Net. However this class requires to allocate buffer equal to the
> file length to zip it (at least all sample code I saw were like that).
> The file size in my case can be really very large and hence I want
> something which does not require to load entire file in memory. Is
> there any way?
You don't need to read the whole file in. Just copy the data from the
input stream to the GZipStream a chunk (eg 32K) at a time.
I've got a utility class which makes this easier:
http://pobox.com/~skeet/csharp/miscutil
and
http://pobox.com/~skeet/csharp/miscu...treamutil.html
in particular.
Jon
On Jun 21, 8:20 am, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> > Is there any way?
>
> http://www.chilkatsoft.com/zip-dotnet.asp
There's no need to go into commercial software here - the only problem
for the OP is that all the samples read the whole of the data into
memory before pumping any of it through the output stream. That's easy
to fix and worth knowing for other situations too
Jon