Avatar of ratkinso666
ratkinso666
 asked on

Compress download file

Hi all, can someone please tell me what the best course of action is for this.  I have a large file that gets downloaded, I would like to compress it, download, then uncompress the file or compress in the stream, like with GZIPStream, but not sure how to do it.  The only examples I can find are incomplete and confusing...  I am using .NET 2.0
Thanks,
Randy
.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
ratkinso666

8/22/2022 - Mon
raterus

Sorry, You don't have that type of control over the downloaded file.  You could compress the file, but the client would have to know the steps to uncompress it, you can't do it for him.
ratkinso666

ASKER
What about the GZIPStream where the file gets compressed while it is being downloaded??  I am trying to download an .mdb access file and they are too big, so am needing to compress them and make them smaller.
raterus

GZipStream works great between two computers connected and running a compatible .Net application.  The web is completely different, downloads occur over HTTP, and the best you can do is zip the file completely and give instructions on how to unzip.  If you really really wanted to do this, you'd have to create a client application that receives the GZipStream over a socket connection, then you can download the file that way.  Mind you, this is not asp.net!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ratkinso666

ASKER
This is over the intranet actually, the people that dial in have really slow connections and timeout before the file is completely downloaded...  so I do have more control over what the clients have..  if that helps..
raterus

Totally off the subject, but have you tried compacting the access database before you make it available to download?  There is an option in Access to do this somewhere.  That can greatly decrease the size of the database.

If you want to do this right, I'd create a client application to download the database, using GZipStream or whatever you want to use.  You probably can even modify asp.net to serve compressed chunks of the file that the client application will download and piece together.  The client program will be better able to handle timeouts, and resuming downloads, and making sure the download is completed successfully.  Unfortunately, I can't help you much with that, that's really out of my expertise.

Before you do this though, you might want to look at some of the download managers that you can install for the browser.  They support resuming downloads when they timeout.  You may have to do something in asp.net to support that though.
ratkinso666

ASKER
The database is compacted, I am looking at using the Chilkat Software possibly, but would rather not use a third party...  Do you or anyone know if VS 2008 has better support for compressing the files, we will be switching to that very soon.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
raterus

When I need to zip something up, I just run 7-zip from the command-line.  There is no need to purchase third-party software to zip something up as long as you have capable programmers.  I'm not sure if VS 2008 has something easier, but I doubt it since Zip is a protected technology.
ratkinso666

ASKER
Unfortunately the people downloading are not programmers, they are users that only know to hit the download button and their databases will be updated....  but now they are getting timeouts since the databases are getting larger..
raterus

You misunderstood me, I'm not implying your users be anything than users.  I was just stating you don't need a third-party tool if you have a capable programmer to work with a command-line utility.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ratkinso666

ASKER
I guess I am still just needing an example of how to use the GZIPStream, it seems like it would work for me, from what I have read on MSDN, but I just can't find a good example of how to use it.
raterus

We just seem to be going in circles now, I've already mentioned why GZIPStream isn't going to work solely over a web browser.
ratkinso666

ASKER
But raterus you said,
"If you want to do this right, I'd create a client application to download the database, using GZipStream or whatever you want to use.  You probably can even modify asp.net to serve compressed chunks of the file that the client application will download and piece together.  The client program will be better able to handle timeouts, and resuming downloads, and making sure the download is completed successfully.  Unfortunately, I can't help you much with that, that's really out of my expertise."

I was wanting to try going the way you recommended???
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
raterus

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ratkinso666

ASKER
Thank you very much for your help, if I need further help with the coding I will just make a separate question.