Pure Rust engine for EPUB, MOBI, AZW3, FB2, KEPUB, LIT, CBZ, PDF, ODT, TXT, and Markdown with Native AI RAG Chunking, C/Python FFI, Web Component, and Readium APIs.
Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or conversations?'
So she was considering in her own mind whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
Designed to deliver 100% feature parity with epub.js and foliate-js in native Rust and WebAssembly.
Pre-computed lowercase section caches allow searching millions of characters in under 1 millisecond.
Native parsers for EPUB 2/3, MOBI, AZW3 (KF8), FictionBook 2 (FB2), KEPUB, and Microsoft Reader (LIT).
Canonical Fragment Identifier parsing, range calculations, and character position ordering.
Native SHA-1 key calculation and XOR byte transformations for protected font files.
Supports `wasm-bindgen` for browser web apps and includes a built-in multithreaded HTTP reader server.
Inlines CSS stylesheets and images into self-contained HTML strings without external blob URIs.
Load any eBook format with auto-detection in 2 lines of code.
use ebook_rs::Book;
fn main() -> Result<(), String> {
// Auto-detects EPUB, MOBI, AZW3, FB2, KEPUB, or LIT from path
let mut book = Book::from_file("alice.azw3")?;
println!("Title: {}", book.metadata().title);
println!("Total Sections: {}", book.spine().len());
// Search full-text across chapters
let matches = book.search("Rabbit");
println!("Found {} search matches", matches.len());
Ok(())
}