Hi, im using the following code to compress a file into a memorystream:
Dim zStream As New MemoryStream, buf(fileSource.Length) As Byte
Dim zipper As New GZipStream(zStream, CompressionMode.Compress, True)
fileSource.Read(buf, 0, fileSource.Length)
zipper.Write(buf, 0, buf.Length)
The problem is, that if the file is about 10MB, then my application will utilize up to 10MB for the zStream, which is why I would like to split the operation up into chunks, so i could write to a file, as the operation goes on.
I want to read i.e. 10K's of data from the file, compress it, copy the zStream to a storagebuffer, and clearing it while performing storing operations from the storagebuffer when it reaches i.e. 32K.
Is this doable

Big buffers for GZipStream
Ro0ke
Well, i do know how to read the file into chunks, but i cannot get the GZipper to compress in chunks, if that's even possible
If the GZipper wants to be able to process the whole buffer until it's done compressing, then there is no other way, than to compress the whole file into a memorystresm (zStream) - however that is very memory consuming, if the source file is big.
keith1000
The first thing I'd try is something like this (declare/set CHUNK_SIZE, or simply replace it with your desired chunk size):
While not fileSource.EndOfStream
fileSource.Read(buf, 0, CHUNK_SIZE)
zipper.Write(buf, 0, buf.Length)
End While