The fastar library provides high-level Python bindings for the Rust `tar`, `flate2`, and `zstd` crates, offering a high-performance solution for working with compressed and uncompressed tar archives. It is currently at version 0.9.0 and has a consistent release cadence, with updates addressing features and underlying Rust library versions.
pip install fastarVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a simple text file, add it to an uncompressed tar archive using `fastar.open` in write mode, and then extract its contents using read mode. It highlights the basic `append` and `unpack` operations.
Upgrade to fastar version 0.9.0 or later to ensure these security fixes are applied: `pip install --upgrade fastar`.
Always explicitly specify the compression mode (e.g., 'w:gz' for gzip, 'w:zst' for Zstandard) when creating compressed archives, or use 'r' for automatic detection when reading.
To safely remove directories that may contain extracted files, use `shutil.rmtree(path)` for recursive deletion instead of `pathlib.Path.rmdir()`, or ensure all individual files are deleted prior to calling `rmdir()`.
Use `shutil.rmtree(path)` from the `shutil` module instead of `path.rmdir()` to remove directories after `fastar` has extracted content into them.
Install the library using pip: `pip install fastar`
Verify that the archive file exists at the provided path, or ensure the target directory for extraction or creation is correct. Use absolute paths or confirm the current working directory.
Adjust the file system permissions for the relevant files or directories, or run the Python script with appropriate elevated privileges.
Use a valid compression mode, such as 'w' for uncompressed writing, 'w:gz' for gzip compressed writing, or 'r' for reading with automatic compression detection, as documented.
No dependency data recorded yet.