+
+ /**
+ * Export a book to a contained ZIP export file.
+ * @throws NotFoundException
+ */
+ public function zip(string $bookSlug, string $chapterSlug, ZipExportBuilder $builder)
+ {
+ $chapter = $this->queries->findVisibleBySlugsOrFail($bookSlug, $chapterSlug);
+ $zip = $builder->buildForChapter($chapter);
+
+ return $this->download()->streamedDirectly(fopen($zip, 'r'), $chapterSlug . '.zip', filesize($zip));
+ }