epub static method
Sniffs an EPUB publication.
Reference: https://www.w3.org/publishing/epub3/epub-ocf.html#sec-zip-container-mime
Implementation
static Future<MediaType?> epub(SnifferContext context) async {
if (context.hasFileExtension(["epub"]) ||
context.hasMediaType("application/epub+zip")) {
return MediaType.epub;
}
String? mimetype = (await context.readArchiveEntryAt("mimetype"))
?.let((it) => ascii.decode(it.buffer.asUint8List()).trim());
if (mimetype == "application/epub+zip") {
return MediaType.epub;
}
return null;
}