Zipping and streaming directory structure to client without temp files

S

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
 
W

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.
 
S

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top