{"id":1094,"library":"fastar","title":"fastar","description":"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.","status":"active","version":"0.9.0","language":"python","source_language":"en","source_url":"https://github.com/DoctorJohn/fastar","tags":["tar","archive","compression","rust","high-performance","bindings"],"install":[{"cmd":"pip install fastar","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"The primary way to interact with the library is through the top-level 'fastar' module.","symbol":"fastar","correct":"import fastar"}],"quickstart":{"code":"from pathlib import Path\nimport fastar\nimport os\n\n# Create a dummy file\ninput_file = Path(\"file.txt\")\ninput_file.write_text(\"Hello, Fastar!\")\n\n# Create a tar archive (uncompressed)\nwith fastar.open(\"archive.tar\", \"w\") as archive:\n    archive.append(input_file)\n\n# Extract the tar archive\noutput_dir = Path(\"output\")\noutput_dir.mkdir(exist_ok=True)\nwith fastar.open(\"archive.tar\", \"r\") as archive:\n    archive.unpack(output_dir)\n\nunpacked_file = output_dir / \"file.txt\"\nprint(f\"Unpacked file content: {unpacked_file.read_text()}\")\n\n# Clean up (optional)\ninput_file.unlink()\nPath(\"archive.tar\").unlink()\noutput_dir.rmdir()","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to fastar version 0.9.0 or later to ensure these security fixes are applied: `pip install --upgrade fastar`.","message":"Versions prior to 0.9.0 may contain security vulnerabilities (CVE-2026-32766 and CVE-2026-33056) inherited from underlying Rust crates like `rust-tar`.","severity":"breaking","affected_versions":"<0.9.0"},{"fix":"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.","message":"The `fastar.open` method supports various modes for compression (`w`, `w:gz`, `w:zst`, `r`, `r:`, `r:gz`, `r:zst`). Using the wrong mode for a compressed archive can lead to errors or corrupted data.","severity":"gotcha","affected_versions":"All versions"},{"fix":"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()`.","message":"After extracting archives with `fastar`, attempting to remove the target directory with `pathlib.Path.rmdir()` will fail if the directory is not empty. This commonly happens if extracted files or subdirectories remain.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `shutil.rmtree(path)` from the `shutil` module instead of `path.rmdir()` to remove directories after `fastar` has extracted content into them.","message":"When using `fastar` to extract content into a directory, users should be aware that standard Python functions like `pathlib.Path.rmdir()` will fail if the directory is not empty. This is expected behavior for `rmdir()`. To reliably remove directories that `fastar` has populated with files, `shutil.rmtree()` should be used instead.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.9.0':38 'address':47 'archiv':32,55 'bind':10,61 'cadenc':44 'compress':28,56 'consist':42 'crate':18 'current':35 'fastar':1,3 'featur':48 'flate2':15 'high':7,22,59 'high-level':6 'high-perform':21,58 'level':8 'librari':4,52 'offer':19 'perform':23,60 'provid':5 'python':9 'releas':43 'rust':13,51,57 'solut':24 'tar':14,31,54 'uncompress':30 'under':50 'updat':46 'version':37,53 'work':26 'zstd':17","created_at":"2026-04-05T13:05:27.133515+00:00","updated_at":"2026-04-16T14:57:05.499384+00:00","problems":[{"fix":"Install the library using pip: `pip install fastar`","cause":"The 'fastar' library is not installed in the Python environment where the code is being executed.","error":"ModuleNotFoundError: No module named 'fastar'"},{"fix":"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.","cause":"The specified archive file or output directory for a 'fastar' operation does not exist at the given path.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'non_existent_archive.tar'"},{"fix":"Adjust the file system permissions for the relevant files or directories, or run the Python script with appropriate elevated privileges.","cause":"The program lacks the necessary file system permissions to read the source archive, or to create/write files or directories at the specified destination using 'fastar'.","error":"PermissionError: [Errno 13] Permission denied: 'output_directory'"},{"fix":"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.","cause":"An unsupported or incorrectly formatted compression mode string was provided to the `fastar.open()` method.","error":"ValueError: Invalid compression mode 'wx' given. Please use one of 'w', 'w:gz', 'w:zst', 'r', 'r:gz', 'r:zst'."}],"ecosystem":"pypi","meta_description":null,"install_score":80,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.11.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/DoctorJohn/fastar","docs":"https://github.com/DoctorJohn/fastar","changelog":null,"pypi":"https://pypi.org/project/fastar/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}