applesauce README

The project's README from github.com/Dr-Emann/applesauce. As one markdown file: README.md.

Applesauce

Applesauce is a command-line interface (CLI) program written in Rust that compresses, decompresses, and prints information about compressed files for HFS+/APFS transparent compression on macOS. It is based on afsctool and offers several key improvements, including better performance, improved multithreading (even for a single file), and reduced memory usage. Applesauce supports all three compression algorithms used by HFS+/APFS: LZFSE, LZVN, and ZLIB.

compression example

Installation

Install via Homebrew

To install Applesauce using Homebrew, run the following command:

brew install Dr-Emann/homebrew-tap/applesauce

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Dr-Emann/applesauce/releases/latest/download/applesauce-cli-installer.sh | sh

Manual build with Cargo

Details

To install Applesauce using Cargo, follow these steps:

  1. Install Rust and Cargo using the instructions provided at rust-lang.org.
  2. Clone this repository to your local machine.
  3. In the project directory, run cargo build --release to build the program.
  4. The built binary can be found in the target/release directory.

Usage

To use Applesauce, run the following command:

applesauce [compress|decompress|info] file/directory

The options are as follows:

For example, to compress a file named example.txt using the ZLIB compression algorithm, you would run:

applesauce compress -c ZLIB example.txt

Features

Applesauce has the following key features:

Compression Algorithms

Applesauce supports three compression algorithms:

Applesauce defaults to using LZFSE compression. Depending on the type of data being compressed and the desired balance between compression ratio and speed, one of these algorithms may be more suitable than the others.

Improvements Over Afsctool

Applesauce is based on afsctool, but offers several key improvements, including:

Improved Performance

afcstool can compress multiple files in parallel, but applesauce parallelizes at the block level, so even a single file can be compressed in parallel. Applesauce can often be several times faster than afsctool, especially for small numbers of large files.

Reduced Memory Usage

afcstool will load the entire file into memory before compressing it (although it does attempt to use mmap for large files). Applesauce will only keep the block(s) currently being compressed in memory.

Better User Interface

Applesauce outputs a pretty progress bar while it's working, providing a more user-friendly experience than afsctool's sparse output.

Better Compression With Many Small Files

afsctool will compress a file which fits in the xattr after compression, even if doing so actually adds more overhead than leaving the file uncompressed. Applesauce will not compress a file if it would result in a larger file.

Better Error Handling

afcstool overwrites files in place. Although it attempts to restore the file if an error occurs, if it is forcefully terminated while compressing a file, the file may be left in an invalid state.

Applesauce compresses/decompresses files to a temporary file and then atomically renames the temporary file to the original file only when the operation is complete: the file is never left in an invalid state, even if the program is harshly terminated.

This is no replacement for backups: please do not use applesauce on files you cannot afford to lose.

License

Applesauce is licensed under the GNU General Public License version 3 (GPLv3).

Contributions

Contributions to Applesauce are welcome! If you would like to contribute code, please open a pull request on the GitHub repository. If you find a bug or have a feature request, please open an issue on the repository.

applesauce (Dr-Emann/applesauce)

Searching Database…

这是什么东西?Applesauce 是一个 Rust 命令行工具,利用 macOS 透明的 HFS+/APFS 文件压缩来压缩、解压和查看文件——它是较老的 afsctool 的现代化替代品。
那它不是像打包成压缩包那样压缩文件吗?不完全是——它用的是文件系统自带的透明压缩,文件留在原地、照常使用,只是占用的磁盘空间变少了。
我需要预先装好 Rust 或其他东西吗?如果你用 Homebrew 或预编译的二进制文件,什么都不用装——它们拿来就能运行。只有从源码构建才需要 Rust 和 Cargo。
在我珍视的文件上运行它安全吗?它会先压缩到一个临时文件,成功后再原子性地重命名,所以即使进程被强制杀掉,也不会留下压缩了一半的文件。不过作者明确表示这不能替代备份:不要用它处理你承受不起丢失的文件。
它在 Linux 或 Windows 上也能用吗?不能——它只支持 macOS。HFS+/APFS 透明压缩是苹果文件系统的特性,在其他系统上它无事可做。
为什么用 applesauce 而不是老的 afsctool?它通常快好几倍,因为它按块并行处理(哪怕单个大文件也能并行),内存里只保留当前正在压缩的块,还显示进度条,在压缩反而会让文件变大时自动跳过,而且出错后绝不会让文件处于无效状态。
三种压缩算法该选哪一个?LZFSE 是默认选项,在速度和压缩率之间比较均衡;LZVN 是苹果针对 64 位处理器优化的选项,压缩率较高;ZLIB 更慢但可以压得更小,尤其在级别 9 时,具体取决于数据。
我能查看一个文件已经压缩得怎么样吗?可以——info 命令会显示文件或目录的压缩率,以及用的是哪种算法(LZFSE、LZVN 还是 ZLIB)。
What are similar projects?dust, veet, fd, duf, macos-sysdata, ripgrep, zerobrew, eza
Creator
Dr-Emann
Size
0.5 MB
Stars
170
Age
3y
Commits · 90 Days