aboutsummaryrefslogtreecommitdiff
path: root/src/epub.rs
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-03-03 11:10:03 +0300
committerA Farzat <a@farzat.xyz>2026-03-03 11:22:00 +0300
commit6aad662ec59a3974cbca6c423c1e08e8bc5e90f6 (patch)
treeeb97ccab865cec7ac530a4c0d2d63f9dfd4c3867 /src/epub.rs
parentb0035a511b13b03c4c73b0cfad488dbab541e01e (diff)
downloadoreilly-epub-6aad662ec59a3974cbca6c423c1e08e8bc5e90f6.tar.gz
oreilly-epub-6aad662ec59a3974cbca6c423c1e08e8bc5e90f6.zip
Add a function to write mimetype
Diffstat (limited to 'src/epub.rs')
-rw-r--r--src/epub.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/epub.rs b/src/epub.rs
index 0c0bc74..f216567 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -7,6 +7,14 @@ use tokio::{
io::AsyncWriteExt,
};
+/// Creates and writes the mimetype. Assumes dest_root already exists.
+pub async fn write_mimetype(dest_root: &Path) -> Result<()> {
+ let dest_path = dest_root.join("mimetype");
+ let mut file = File::create(dest_path).await?;
+ file.write_all(b"application/epub+zip").await?;
+ Ok(())
+}
+
pub async fn download_all_files(
client: &Client,
file_entries: &[FileEntry],