擷取 BZIP2
BZIP2,即"Burrows-Wheeler區塊排序文字壓縮器",是一種在Unix和Linux系統中常用的檔案壓縮工具。 顧名思義,它非常適合壓縮單一文字檔案。 雖然這種格式在這些作業系統中很流行,但有時提取也會失敗。 這通常是因為解壓縮大型 BZIP2 檔案比其他格式需要更多的記憶體和 CPU 資源,或者當提取庫不支援嵌套歸檔(例如 TAR 檔案)時可能會發生這種情況。
但是,IronZIP 支援所有這些格式,消除了任何相容性問題。 它也可在所有主流作業系統上運作。 以下是一個提取 BZIP2 檔案的簡單範例。
使用 C# 提取 BZIP2 文件
- 使用 IronZip;
- IronBZip2Archive.ExtractArchiveToDirectory("output.txt.bz2", "已擷取");
提取 BZIP2 壓縮包
We can easily access the functionalities of the IronZIP namespace in our project. Specifically, the IronBZIP2Archive class includes a method called ExtractArchiveToDirectory, which allows us to extract the contents of a BZIP2 file.
The ExtractArchiveToDirectory method in the IronBZIP2Archive class is designed to unpack the contents of a BZIP2 file into a specified directory. 第一個必要參數是 BZIP2 檔案的完整路徑,第二個參數指示目標資料夾。 開發人員可以依靠此流程來確保效率和安全性。
It is important to note that both the original file extension and the .bz2 extension must be included in the file name. This is because the file extension is removed during the compression process, and the method also removes the .bz2 extension during extraction.




