API Reference
This section contains the complete API documentation for tzst, providing detailed information about classes, functions, and exceptions.
Overview
The tzst library provides both high-level convenience functions and a comprehensive class-based API for working with .tzst
/.tar.zst
archives. The library is designed with security, performance, and ease of use in mind.
Main Components
Core API: Core functionality including
TzstArchive
class and convenience functions for archive operationsCLI API: Command-line interface functions and utilities for batch operations
Exceptions API: Custom exception classes for comprehensive error handling and debugging
Architecture Overview
The tzst library follows a layered architecture:
High-Level API: Convenience functions for common operations
Class-Based API:
TzstArchive
class for advanced controlCLI Interface: Command-line tools for interactive and scripted use
Exception System: Comprehensive error handling for robust applications
Quick Reference
Core Classes
A class for handling .tzst/.tar.zst archives. |
The main class for archive manipulation with context manager support and comprehensive functionality.
Convenience Functions
Create a new .tzst archive with atomic file operations. |
|
Extract files from a .tzst archive. |
|
List contents of a .tzst archive. |
|
Test the integrity of a .tzst archive. |
High-level functions that provide simple interfaces for common archive operations.
CLI Functions
Main entry point for the tzst command-line interface. |
|
Create and configure the command-line argument parser. |
|
Print the version and copyright banner. |
|
Format file size in human-readable format. |
|
Validate and return compression level. |
Command-line interface utilities for interactive and batch operations.
Exception Classes
Base exception for all tzst operations. |
|
Exception raised when archive operations fail. |
|
Exception raised when compression operations fail. |
|
Exception raised when decompression operations fail. |
Exception hierarchy for comprehensive error handling and debugging support.
Key Features
Security First
Built-in path traversal protection
Multiple security filter options
Safe extraction by default
High Performance
Zstandard compression with configurable levels
Streaming support for large archives
Memory-efficient operations
Developer Friendly
Clean, Pythonic API
Comprehensive error handling
Context manager support
Extensive documentation and examples
Cross-Platform
Works on Windows, macOS, and Linux
Consistent behavior across platforms
Native performance optimizations