Home All Groups Group Topic Archive Search About

Zipping and streaming directory structure to client without temp files

Author
13 Oct 2005 12:57 PM
Søren M. Olesen
Hi

I need to zip and send a bunch of files (2 Gb) in a directory structure to a
Web clinet. Using XCeed I've been able to zip the directory structure into a
temporary file and the send it to the client. However it takes quite some
time to zip the files, so sometimes the client timesout evenbefore the temp
file is done. Is there a way to Zip and Send at the same time? Would it be
possible to write and read from a memorystrream at the same time (using two
different threads)

TIA

Søren

Author
13 Oct 2005 1:32 PM
William Stacey [MVP]
yes. you can use the gzip class in .net to do this.  But you do it stream by
stream, not zip all files together into one.  I assume this would not be an
issue as long as all files are compressed so you still get the desired
effect. You can wrap each file stream in a gzip stream to read compressed
bytes, and send that block to the socket, then do reverse.

--
William Stacey [MVP]

Show quote
"Søren M. Olesen" <smole***@hotmail.com> wrote in message
news:%23hPTqX$zFHA.1640@TK2MSFTNGP12.phx.gbl...
> Hi
>
> I need to zip and send a bunch of files (2 Gb) in a directory structure to
> a Web clinet. Using XCeed I've been able to zip the directory structure
> into a temporary file and the send it to the client. However it takes
> quite some time to zip the files, so sometimes the client timesout
> evenbefore the temp file is done. Is there a way to Zip and Send at the
> same time? Would it be possible to write and read from a memorystrream at
> the same time (using two different threads)
>
> TIA
>
> Søren
>
>
>
>
Author
19 Oct 2005 6:57 AM
Søren M. Olesen
Hi William

Unfortunately I need to receive the file on the client as they were sipped
together in one zip file with directory structure and all......

I don't really know how ZIP works, but if it just writes to a file without
seeking it, I guess I can start reading it before it's completely written.
However I won't know the exact size of the file when I start sending it to
the client, so how do I setup the Content-Length?? can I just set it to
something large, and then just flusg the Response object??

TIA

Søren






Show quote
"William Stacey [MVP]" <william.sta***@gmail.com> wrote in message
news:ePdJfq$zFHA.560@TK2MSFTNGP12.phx.gbl...
> yes. you can use the gzip class in .net to do this.  But you do it stream
> by stream, not zip all files together into one.  I assume this would not
> be an issue as long as all files are compressed so you still get the
> desired effect. You can wrap each file stream in a gzip stream to read
> compressed bytes, and send that block to the socket, then do reverse.
>
> --
> William Stacey [MVP]
>
> "Søren M. Olesen" <smole***@hotmail.com> wrote in message
> news:%23hPTqX$zFHA.1640@TK2MSFTNGP12.phx.gbl...
>> Hi
>>
>> I need to zip and send a bunch of files (2 Gb) in a directory structure
>> to a Web clinet. Using XCeed I've been able to zip the directory
>> structure into a temporary file and the send it to the client. However it
>> takes quite some time to zip the files, so sometimes the client timesout
>> evenbefore the temp file is done. Is there a way to Zip and Send at the
>> same time? Would it be possible to write and read from a memorystrream at
>> the same time (using two different threads)
>>
>> TIA
>>
>> Søren
>>
>>
>>
>>
>
>

AddThis Social Bookmark Button