Pure Rust engine for EPUB 2/3, KFX, MOBI, AZW3, FB2, KEPUB, LIT, CBZ, PDF, DOCX, ODT, RTF, PPTX, LaTeX, Typst, AsciiDoc, Org, reST, PDB, PMLZ, RB, TCR, HTMLZ, TXTZ, OEB, ZIP, HTML, TXT, and Markdown with Native AI RAG Chunking, MCP Server, Python/WASM/C FFI, 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.
Bidirectional parsers & exporters for EPUB 2/3, KFX, MOBI, AZW3, FB2, KEPUB, DOCX, ODT, RTF, PDF, PPTX, TeX, Typst, AsciiDoc, Org, reST, PDB, PMLZ, RB, TCR, HTMLZ, TXTZ, OEB, ZIP, HTML, TXT, and Markdown.
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(())
}