PC Review


Reply
Thread Tools Rate Thread

Decompress gz file

 
 
DavidC
Guest
Posts: n/a
 
      3rd May 2010
We have a file downloaded from another company in the format filename.csv.gz
that apparently was compressed with GZipStream. I would like to create a
class that decompresses it (which it does with WinZip) from an asp.net page.
I found the code below in msdn that is suppose to work. However, the line
that reads

Decompress.CopyTo(outFile)

gives an error that CopyTo is not a method in GZipStream. Can anyone help me
resolve this? It seems like a clean process if I can get it to work. Thanks.

Private Sub Decompress(ByVal fi As FileInfo)
' Get the stream of the source file.
Using inFile As FileStream = fi.OpenRead()
' Get orignial file extension, for example "doc" from
report.doc.gz.
Dim curFile As String = fi.FullName
Dim origName = curFile.Remove(curFile.Length -
fi.Extension.Length)

' Create the decompressed file.
Using outFile As FileStream = File.Create(origName)
Using Decompress As GZipStream = New GZipStream(inFile, _
CompressionMode.Decompress)

' Copy the decompression stream
' into the output file.
Decompress.CopyTo(outFile)

Console.WriteLine("Decompressed: {0}", fi.Name)

End Using
End Using
End Using
End Sub

--
David
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does XP have a file to decompress *.gz files? Jackson Windows XP Basics 18 30th Mar 2010 12:36 PM
Is there a way to decompress a file programmatically? Academia Microsoft VB .NET 4 9th Jan 2008 12:27 AM
Use GZipStream to decompress winzip file =?Utf-8?B?VmFuY291dmVyTWlrZQ==?= Microsoft Dot NET Framework 5 30th Jul 2007 07:55 PM
win32 wont decompress dl_ file =?Utf-8?B?YmVu?= Windows XP Print / Fax 3 29th May 2004 05:00 AM
How to decompress and display packed (zip) text file within ASP ? umberto Microsoft ASP .NET 4 24th Oct 2003 09:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:38 PM.