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 — это возможность файловых систем Apple, поэтому на других системах ей просто нечего делать.
Почему applesauce, а не старый afsctool?Он часто в несколько раз быстрее, потому что распараллеливает работу на уровне блоков (даже для одного большого файла), держит в памяти только те блоки, которые сжимаются прямо сейчас, показывает полосу прогресса, пропускает сжатие, если оно увеличило бы файл, и после ошибок никогда не оставляет файлы в некорректном состоянии.
Какой из трёх алгоритмов сжатия выбрать?LZFSE стоит по умолчанию и уравновешивает скорость и степень сжатия; LZVN — вариант Apple, оптимизированный под 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