public class ZipBin
{
public byte[] bytes;
//C#读取压缩文件(将压缩文件转换为二进制
public void GetZipToByte(string inpath)
{
FileStream fs = new FileStream(inpath, FileMode.Open);
bytes = new byte[fs.Length];
int count = Convert.ToInt32(fs.Length);
fs.Read(bytes, 0, count);
}
//C#将二进制转换为压缩文件
public void GetByteToZip(string outpath)
{
string path = outpath;//压缩文件的地址
File.WriteAllBytes(path, bytes);
}
}
转载于:https://www.cnblogs.com/aweifly/p/3410865.html原文:https://www.cnblogs.com/Striveyoungfellow/p/12845075.html