Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi friends

i want to zip file larger than 2 gig , than i whant a safe source
pl help
Posted
Comments
Sergey Alexandrovich Kryukov 9-Apr-14 0:56am    
First of all, 2Gb is nothing. You can always find an open-source code doing ZIP, did you try that?
—SA
So, what is the issue?
Member 10598179 9-Apr-14 1:07am    
yes i have no problem with zip file u 2g
and when i have larger i breake file to ang part than ziped any but it is not a good way
Please see Sergey's Solution.

1 solution

Please see my comment to the question.

I usually advise the choice between SharpCompress, #ziplib and 7-zip for .NET:
how to add file name in zip folder with same file name in c#[^],
Zipping of files in C# 4.0[^].

—SA
 
Share this answer
 
Comments
Member 10598179 9-Apr-14 1:34am    
i us
using ICSharpCode.SharpZipLib.Zip;

and it is my code:
FileStream vFileStream = File.OpenRead(vInputPath + vFileName);
byte[] obuffer;
obuffer = new byte[vFileStream.Length];
ZipOutputStream vZipOutputStream = new ZipOutputStream(File.Create(vOutputPath + vFileName + ".zip"));
ZipEntry vZipEntry = new ZipEntry(vFileName);

vZipOutputStream.SetLevel(9);
vZipOutputStream.PutNextEntry(vZipEntry);

vFileStream.Read(obuffer, 0, obuffer.Length);
vZipOutputStream.Write(obuffer, 0, obuffer.Length);
vFileStream.Close();

vZipOutputStream.Finish();
vZipOutputStream.Close();
but when the size file is greater than 2 gig , it get exeption on buffer overfow !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900