2 releases

0.1.1 Jun 27, 2025
0.1.0 Jun 27, 2025

#2271 in Text processing

28 downloads per month

GPL-3.0 license

23KB
355 lines

oeb-rs

how to use

    /* release oeb file */
    let mut instance = OebUnpack::new("test.oeb");
    if let Ok(assets) = instance.analysis() {
        assert!(assets.len() > 0);
        for asset in assets {
            //save assets file to local
            let path = instance.save_to(&asset.content_id, save_folder_path).unwrap();
            assert!(path.is_some());
        }
    } else {
        assert!(false);
    }
    instance.close();
    /* read oeb file */
    let mut instance = OebReader::new("test.oeb", temp_folder_path);
    instance.init();
    let chapters = instance.chapters();
    println!("chapters: {:?}", chapters);
    for (id, title) in chapters.unwrap_or_default() {
        let content = instance.get_chapter_content(&id);
        println!("title:{}, content: {}", title, content.unwrap());
    }
    //clear cache files
    instance.close();

Dependencies

~8–10MB
~191K SLoC