SharpCompress 0.45.0-beta.10

SharpCompress

SharpCompress is a compression library in pure C# for .NET Framework 4.8, .NET 8.0 and .NET 10.0 that can unrar, un7zip, unzip, untar unbzip2, ungzip, unlzip, unzstd, unarc and unarj with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip/lzip are implemented.

The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).

NEW: All I/O operations now support async/await for improved performance and scalability. See the USAGE.md for examples.

GitHub Actions Build - SharpCompress Static Badge

Need Help?

Post Issues on Github!

Check the Supported Formats and Basic Usage.

In general, I recommend GZip (Deflate)/BZip2 (BZip)/LZip (LZMA) as the simplicity of the formats lend to better long term archival as well as the streamability. Tar is often used in conjunction for multiple files in a single archive (e.g. .tar.gz)

Zip is okay, but it's a very hap-hazard format and the variation in headers and implementations makes it hard to get correct. Uses Deflate by default but supports a lot of compression methods.

RAR is not recommended as it's a proprietary format and the compression is closed source. Use Tar/LZip for LZMA

7Zip and XZ both are overly complicated. 7Zip does not support streamable formats. XZ has known holes explained here: (http://www.nongnu.org/lzip/xz_inadequate.html) Use Tar/LZip for LZMA compression instead.

ZStandard is an efficient format that works well for streaming with a flexible compression level to tweak the speed/performance trade off you are looking for. We currently only implement decompression for ZStandard but as we leverage the ZstdSharp library one could likely add compression support without much trouble (PRs are welcome!).

A Simple Request

Hi everyone. I hope you're using SharpCompress and finding it useful. Please give me feedback on what you'd like to see changed especially as far as usability goes. New feature suggestions are always welcome as well. I would also like to know what projects SharpCompress is being used in. I like seeing how it is used to give me ideas for future versions. Thanks!

Please do not email me directly to ask for help. If you think there is a real issue, please report it here.

Want to contribute?

I'm always looking for help or ideas. Please submit code or email with ideas. Unfortunately, just letting me know you'd like to help is not enough because I really have no overall plan of what needs to be done. I'll definitely accept code submissions and add you as a member of the project!

Notes

XZ implementation based on: https://github.com/sambott/XZ.NET by @sambott

XZ BCJ filters support contributed by Louis-Michel Bergeron, on behalf of aDolus Technology Inc. - 2022

7Zip implementation based on: https://code.google.com/p/managed-lzma/

LICENSE Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Showing the top 20 packages that depend on SharpCompress.

Packages Downloads
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,Excel简单导出,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载和FTP客户端,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展等常用封装。 官网教程:https://ldqk.org/55 github:https://github.com/ldqk/Masuit.Tools
1
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。 官网教程:https://masuit.com/55 github:https://github.com/ldqk/Masuit.Tools
1
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。 官网教程:https://masuit.com/55 github:https://github.com/ldqk/Masuit.Tools
1
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。 官网教程:https://masuit.com/55 github:https://github.com/ldqk/Masuit.Tools
1
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。 示例代码: 1.检验字符串是否是Email bool isEmail="1170397736@qq.com".MatchEmail(); 2.获取线程内唯一对象 CallContext<T>.GetData("db"); 3.获取当前请求上下文 var context=HttpContext2.Current; 4.获取IP详细地理信息 var address="114.114.114.114".GetPhysicsAddress(); 5.大文件操作 FileStream fs = new FileStream(@"D:\boot.vmdk", FileMode.OpenOrCreate, FileAccess.ReadWrite); { //fs.CopyToFile(@"D:\1.bak");//同步复制大文件 fs.CopyToFileAsync(@"D:\1.bak");//异步复制大文件 string md5 = fs.GetFileMD5Async().Result;//异步获取文件的MD5 } 6.html的防XSS处理: string html = @"<link href="/Content/font-awesome/css" rel="stylesheet" /> <!--[if IE 7]> <link href='/Content/font-awesome-ie7.min.css' rel='stylesheet'/> <![endif]--> <script src="/Scripts/modernizr"></script> <div id="searchBox" role="search"> <form action="/packages" method="get"> <span class="user-actions"><a href="/users/account/LogOff">退出</a></span> <input name="q" id="searchBoxInput" /> <input id="searchBoxSubmit" type="submit" value="Submit" /> </form> </div>"; string s = html.HtmlSantinizerStandard();//清理后:<div><span><a href="/users/account/LogOff">退出</a></span></div>
1

.NET Framework 4.8

.NET 8.0

  • No dependencies.

.NET 10.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
0.45.0-beta.10 1 01/10/2026
0.45.0-beta.7 1 01/10/2026
0.44.0 1 01/10/2026
0.44.0-beta.46 1 01/10/2026
0.44.0-beta.44 1 01/10/2026
0.44.0-beta.40 1 01/10/2026
0.44.0-beta.33 1 01/10/2026
0.44.0-beta.28 1 01/10/2026
0.44.0-beta.26 1 01/10/2026
0.44.0-beta.23 1 01/10/2026
0.44.0-beta.15 1 01/10/2026
0.44.0-beta.13 1 01/10/2026
0.44.0-beta.6 1 01/10/2026
0.43.0 1 01/10/2026
0.43.0-beta.168 1 01/10/2026
0.42.1 1 01/10/2026
0.42.0 1 01/10/2026
0.41.0 1 01/10/2026
0.40.0 1 01/10/2026
0.39.0 1 01/10/2026
0.38.0 1 01/10/2026
0.37.2 1 01/10/2026
0.36.0 1 01/10/2026
0.35.0 1 01/10/2026
0.34.2 1 01/10/2026
0.34.1 1 01/10/2026
0.34.0 1 01/10/2026
0.33.0 1 01/10/2026
0.32.2 1 01/10/2026
0.32.1 1 01/10/2026
0.32.0 1 01/10/2026
0.31.0 1 01/10/2026
0.30.1 1 01/10/2026
0.30.0 1 01/10/2026
0.29.0 1 01/10/2026
0.28.3 1 01/10/2026
0.28.2 1 01/10/2026
0.28.1 1 01/10/2026
0.28.0 1 01/10/2026
0.27.1 1 01/10/2026
0.27.0 1 01/10/2026
0.26.0 1 01/10/2026
0.25.1 1 01/10/2026
0.25.0 1 01/10/2026
0.24.0 1 01/10/2026
0.23.0 1 01/10/2026
0.22.0 1 01/10/2026
0.21.1 1 01/10/2026
0.21.0 1 01/10/2026
0.20.0 1 01/10/2026
0.19.2 1 01/10/2026
0.19.1 1 01/10/2026
0.19.0 1 01/10/2026
0.18.2 1 01/10/2026
0.18.1 1 01/10/2026
0.18.0 1 01/10/2026
0.17.1 1 01/10/2026
0.17.0 1 01/10/2026
0.16.2 0 05/31/2017
0.16.1 1 01/10/2026
0.16.0 1 01/10/2026
0.15.2 1 01/10/2026
0.15.1 1 01/10/2026
0.15.0 1 01/10/2026
0.14.1 1 01/10/2026
0.14.0 1 01/10/2026
0.13.1 1 01/10/2026
0.13.0 1 01/10/2026
0.12.4 1 01/10/2026
0.12.3 1 01/10/2026
0.12.2 1 01/10/2026
0.12.1 1 01/10/2026
0.12.0 1 01/10/2026
0.11.6 1 01/10/2026
0.11.5 1 01/10/2026
0.11.4 1 01/10/2026
0.11.3 1 01/10/2026
0.11.2 1 01/10/2026
0.11.1 1 01/10/2026
0.11.0 1 01/10/2026
0.10.3 1 01/10/2026
0.10.2 1 01/10/2026
0.10.1.3 1 01/10/2026
0.10.1.1 1 01/10/2026
0.10.1 1 01/10/2026
0.10.0 1 01/10/2026
0.9.0 1 01/10/2026
0.8.2 1 01/10/2026
0.8.1 1 01/10/2026
0.8.0 1 01/10/2026
0.7.0 1 01/10/2026
0.6.0 1 01/10/2026
0.5.0 1 01/10/2026
0.4.0 1 01/10/2026
0.3.0 1 01/10/2026
0.2.0 1 01/10/2026