Thursday, February 4, 2010

how to UNZIP folder from DEFLATE function

string filename1 = Server.MapPath("aatish.zip");
FileStream infile1 = File.OpenRead(filename1);
DeflateStream deflateStream =
new DeflateStream(infile1, CompressionMode.Decompress);
byte[] buffer1 = new byte[infile1.Length + 100];
int offset = 0;
int totalCount = 0;
while (true)
{
int bytesRead = deflateStream.Read(buffer1, offset, 100);
if (bytesRead == 0)
{ break; }
offset += bytesRead;
totalCount += bytesRead;
}
FileStream outfile1 = File.Create(Path.ChangeExtension(filename1, "txt"));
outfile.Write(buffer1, 0, buffer1.Length);
outfile.Close();

No comments:

Post a Comment