Crate mobi

source ·
Expand description

An implementation of MOBI format data parsing and manipulation, written in Rust.

The code is available on GitHub

License: MIT


Access basic info

use mobi::{Mobi, MobiError};
fn main() -> Result<(), MobiError> {
    let book = vec![0, 0, 0];
    // You can either create a Mobi struct from a slice
    let m = Mobi::new(&book)?;
    // Or from an instance of io::Read
    let stdin = std::io::stdin();
    let mut handle = stdin.lock();
    let m = Mobi::from_read(&mut handle)?;
    // Or from filesystem
    let m = Mobi::from_path("/some/path/to/")?;

    // Access metadata
    let title = m.title();
    let author =;
    let publisher = m.publisher().unwrap_or_default();
    let desc = m.description().unwrap_or_default();
    let isbn = m.isbn().unwrap_or_default();
    let pub_date = m.publish_date().unwrap_or_default();
    let contributor = m.contributor().unwrap_or_default();

    // Access Headers
    let metadata = &m.metadata;
    let header = &metadata.header; // Normal Header
    let pdheader = &metadata.palmdoc; // PalmDOC Header
    let mheader = &; // MOBI Header
    let exth = &metadata.exth; // Extra Header

    // Access content
    let content = m.content_as_string();



pub use crate::headers::MobiMetadata;


Module with headers from book containg more extracted data not available through public API.


Structure that holds parsed ebook information and contents


Type Definitions