C# 生成压缩包

引用 Nuget包 ICSharpCode.SharpZipLib

using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class ZipHelper
    {
        /// <summary>
        /// 生成压缩包
        /// </summary>
        /// <param name="folderPath">获取文件和目录的目录</param>
        /// <param name="outputFilePath">创建的zip文件名称</param>
        /// <param name="recurse">递归目录为True,不递归为false</param>
        public static void CreateZip(string folderPath,string outputFilePath,bool recurse = false)
        {
            (new FastZip()).CreateZip(outputFilePath, folderPath, recurse, "");
        }
    }
}

相关推荐:
https://www.jb51.net/article/247317.htm

posted on 2022-08-29 11:17  糯米白白  阅读(79)  评论(0编辑  收藏  举报

导航