boko
A fast, lightweight Rust library for converting between EPUB and Kindle (AZW3/MOBI) ebook formats.
Features
- Fast: 100-200x faster than calibre's ebook-convert
- Lightweight: Pure Rust with minimal dependencies
- Complete: Preserves metadata, table of contents, images, fonts, and CSS
- Flexible: Use as a library or command-line tool
- Cross-platform: Native binaries for all platforms, plus WebAssembly for browsers
Performance
Benchmarks converting a 450KB ebook on an AMD Ryzen 9 7950X:
| Conversion | boko | calibre | Speedup |
|---|---|---|---|
| EPUB → AZW3 | 4.5 ms | 1,039 ms | 230x |
| AZW3 → EPUB | 3.2 ms | 564 ms | 176x |
Installation
Requires Rust nightly (uses edition 2024 features).
CLI
Library
[]
= { = "0.1", = false }
Usage
Command Line
# Convert EPUB to AZW3
# Convert AZW3/MOBI to EPUB
# Show book metadata
Library
use Book;
// Open and convert with automatic format detection
let book = open?;
book.save?;
For explicit format control (Format: Epub, Azw3, Mobi):
use ;
let book = open_format?;
book.save_format?;
Free functions are also available:
use ;
let book = read_epub?;
write_mobi?;
Creating Books Programmatically
use ;
let mut book = new;
book.metadata = new
.with_author
.with_language;
// Add content
book.add_resource;
book.add_spine_item;
book.toc.push;
// Save as EPUB or AZW3
book.save?;
book.save?;
Web App
A browser-based converter is available at zacharydenton.github.io/boko. All conversions happen locally in your browser using WebAssembly.
Supported Formats
| Format | Read | Write |
|---|---|---|
| EPUB 2/3 | ✓ | ✓ |
| AZW3 (KF8) | ✓ | ✓ |
| MOBI | ✓ | ✓* |
*MOBI output uses the modern KF8 format (same as AZW3).
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
MIT