| | |
Decompress large file
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2009
Posts: 39
Reputation:
Solved Threads: 0
Hi Folks,
I'm using this code I found online to decompress a large file. It works fine when I try it with a small file i.e. a 5MB mp3 (1.7MB compressed) but when I try and use it with a 250MB file (27MB compressed), the newly created output file is the same size as the input compressed file (AFAIK, it is probably a copy). I have tried this on a machine with 256MB of RAM and a machine with 4GB of RAM...
Your help is appreciated.
Thanks
I'm using this code I found online to decompress a large file. It works fine when I try it with a small file i.e. a 5MB mp3 (1.7MB compressed) but when I try and use it with a 250MB file (27MB compressed), the newly created output file is the same size as the input compressed file (AFAIK, it is probably a copy). I have tried this on a machine with 256MB of RAM and a machine with 4GB of RAM...
C# Syntax (Toggle Plain Text)
protected void Decompress(string filePath,string fileout) { FileStream sourceFile = File.OpenRead(filePath); FileStream destinationFile = File.Create(fileout); GZipStream unzip = null; byte[] buffer = new byte[sourceFile.Length]; try { unzip = new GZipStream(sourceFile, CompressionMode.Decompress, false); int numberOfBytes = unzip.Read(buffer, 0, buffer.Length); destinationFile.Write(buffer, 0, numberOfBytes); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sourceFile.Close(); destinationFile.Close(); unzip.Close(); } }
Your help is appreciated.
Thanks
Have you tried using the SharpZip? It's probably much better at handling compression. http://www.icsharpcode.net/OpenSource/SharpZipLib/
-Ryan Hoffman
.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
![]() |
Similar Threads
- Best File Compression Software? (Windows Software)
- Large File Support - Win32 (Python)
- Problem in reading a large file (C++)
- Large File Download (PHP)
- save ram file to hard disk,how? (Graphics and Multimedia)
- Telling users file is too large (PHP)
- Code not working for deleting recordfrom a file (Visual Basic 4 / 5 / 6)
- Having problems with a file type (Geeks' Lounge)
Other Threads in the C# Forum
- Previous Thread: On-the-fly automated file download
- Next Thread: Accessing a form's "close" button using win32 API
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom customactiondata database datagrid datagridview dataset datastructure date/time datetime datetimepicker degrees development dll draganddrop drawing encryption enum event excel file filename files form format forms function gdi+ gis gtk hash image index input install java label list listbox mandelbrot math mouseclick mysql operator outlook2003 path photoshop picturebox pixelinversion pixelminversion post programming radians regex remoting richtextbox safari server sleep snooze socket sql statistics stream string table tables tcp text textbox thread time timer update usercontrol usercontrols validation visualstudio webbrowser webcam wia windows winforms wpf xml





