bale
Warning: This project is a work-in-progress. It has known bugs, incomplete features, and the API will change. Use at your own risk.
A Rust library and CLI for working with bale archives - a mmap-first, zero-copy zip-compatible archive format with fixed-stride entries for efficient random access.
Features
- Zip-compatible: Archives can be read by standard zip tools (unzip, zipinfo, etc.)
- Memory-mapped: Designed for efficient mmap-based access
- Zero-copy: Fixed-stride entries enable direct access without parsing
- 4K aligned: File data aligned to 4096 bytes for optimal I/O
Installation
Requires Rust 1.89.0 or later.
Or add to your Cargo.toml:
[]
= "0.1"
Usage
CLI
Create an empty bale archive:
Add files to an archive:
# Add with a path prefix
List entries in an archive:
Extract entries from an archive:
# Extract all entries to current directory
# Extract to a specific directory
# Extract specific entries
Delete entries from an archive:
Compact an archive to reclaim space from deleted entries:
Mount an archive as a FUSE filesystem:
# Mount at a specific directory
# Interactive shell at mount point
# Run a command against mounted archive
# Use python3 via shell
Library
use ;
// Create a new archive and add an entry
let mut writer = create?;
writer.add_entry?;
writer.sync?;
// Read from an archive
let reader = open?;
if let Some = reader.find_entry
Format
Bale extends the zip format with constraints that enable efficient random access:
| Property | Value |
|---|---|
| Alignment | 4096 bytes |
| Max path length | 256 bytes |
| Byte order | Little-endian |
| EOCD | Standard 22-byte zip format |
Development
# Build
# Test
# Lint
# Format
Status
Version 0.1.0. The format is stable but the API may change in future releases.
License & Copyright
Licensed under the Apache License, Version 2.0. See LICENSE.txt for details.
Copyright 2025 Adam Mill