computeResourcePages static method

Future<int> computeResourcePages(
  1. Publication publication,
  2. Link link
)

Implementation

static Future<int> computeResourcePages(
    Publication publication, Link link) async {
  MediaType mediaType = link.mediaType;
  if (mediaType.isBitmap || mediaType == MediaType.pdf) {
    return 1;
  }
  int length = (await publication.fetcher.get(link).length())
      .getOrElse((failure) => 0);
  int res = (length / _pageSize).ceil();
  return res;
}