yaepub 1.0.2 copy "yaepub: ^1.0.2" to clipboard
yaepub: ^1.0.2 copied to clipboard

A simple, lightweight and robust Dart package for parsing EPUB files, extracting metadata, chapters, and content to build e-book readers.

yaepub #

Pub Version Dart style: lints License: MIT

Yet Another EPUB parser for Dart.

yaepub is a lightweight, pure Dart library to extract content, structure, and metadata from EPUB files. It provides an intuitive API to parse EPUB 2/3 metadata, the manifest, the reading order (spine), and the table of contents.

Features #

  • 📖 Extract essential book metadata (title, author, publisher, description, language, publication date, ISBN, UUID).
  • 🖼️ Retrieve the book's cover image.
  • 📚 Read the Table of Contents (Navigation) and Reading Order (Spine).
  • 🗂️ Direct access to internal files and the manifest map.
  • ⚡ Zero native dependencies; fully written in Dart.

Installation #

Add yaepub to your pubspec.yaml:

dependencies:
  yaepub: ^1.0.0

Then run dart pub get or flutter pub get.

Usage #

Here is a quick example of how to use yaepub to parse an EPUB file:

import 'dart:io';
import 'package:yaepub/yaepub.dart';

Future<void> main() async {
  // 1. Read the EPUB file as bytes
  final file = File('path/to/your/book.epub');
  final bytes = await file.readAsBytes();

  // 2. Parse the EPUB book
  final book = Book.from(bytes: bytes);

  // 3. Access metadata
  print(book); // Book(title: "Book Title", author: "Book Author", language: "en")
  print('Publisher: ${book.publisher}');
  print('Date: ${book.date}');
  
  // 4. Access Structural Data
  print('Spine Items: ${book.spine.length}');
  print('Chapters/Nav: ${book.navigation.length}');
  
  // 5. Check if it has a cover
  if (book.cover != null) {
    print('Cover ID: ${book.cover!.id}');
  }
}

Contributing #

Contributions are welcome! Please open an issue or submit a pull request if you find bugs or want to add features.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
70
points
194
downloads

Publisher

verified publisheraestesis.org

Weekly Downloads

A simple, lightweight and robust Dart package for parsing EPUB files, extracting metadata, chapters, and content to build e-book readers.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

archive, collection, crypto, mime_type, path, xml

More

Packages that depend on yaepub