| | |
Decompress large file
![]() |
•
•
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: Recognize and use spaces in multiline textbox
- Next Thread: Accessing a form's "close" button using win32 API
Views: 693 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C#
.net 2d access algorithm application array barchart bitmap box broadcast button buttons c# check checkbox class code color combo control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption event excel file form format forms ftp function game gcd gdi+ graphics http image index input java label list listbox listener login math monodevelop mouseclick mysql object oracle path photoshop php picturebox pixel post print process programming radians recursion regex remote remoting resource resourcefile richtextbox round saving search server socket sql statistics stream string text textbox time timer update validation view visual webbrowser windows winforms wpf xml





