openBook static method

Future<EpubBookRef> openBook(
  1. List<int> bytes
)

Opens the book asynchronously without reading its content. Holds the handle to the EPUB file.

Implementation

static Future<EpubBookRef> openBook(List<int> bytes) async {
  final epubArchive = ZipDecoder().decodeBytes(bytes);

  final schema = await SchemaReader.readSchema(epubArchive);
  schema.package.metadata.titles
      .firstWhere((String name) => true, orElse: () => '');
  final authorList = schema.package.metadata.creators
      .map((EpubMetadataCreator creator) => creator.creator)
      .toList();
  final author = authorList.join(', ');
  final constData = ConstEpubBookRefData(
    epubArchive,
    null,
    author,
    authorList,
    schema,
  );
  final bookRef = EpubBookRef(constData);
  bookRef.content = ContentReader.parseContentMap(bookRef);
  return bookRef;
}