EpubResourceFetcher

fun EpubResourceFetcher(client: HttpClient, maxBytes: Int = DEFAULT_MAX_REMOTE_RESOURCE_BYTES, configure: HttpRequestBuilder.() -> Unit = {}): EpubResourceFetcher(source)

A fetcher for the resources that a book names by an absolute https URL, such as a font or an image on a web server (EPUB 3.3, 3.6), on your client (#38). Set it on the book's settings:

val settings = EpubSettings(resourceFetcher = EpubResourceFetcher(client))
val doc = KiteDoc.openUrl("https://example.com/book.epub", client, epubSettings = settings)

It fetches https only, as EPUB Reading Systems 3.3, 3.3 asks: any other URL gets null without a request. A failure of any kind, a non-2xx status or a body over maxBytes included, gets null too, and the book shows the resource's fallback. As with openUrl, the client is yours, and configure applies to each GET.

A fetch tells the URL's server that the book was opened, and the book's author chose that server, so a book fetches nothing unless its settings carry a fetcher.