Skip to content

Conversation

@untitaker
Copy link

When creating entries, we cannot use Tokio to write file contents. Fix
that.

When creating entries, we cannot use Tokio to write file contents. Fix
that.
@Majored
Copy link
Owner

Majored commented Aug 9, 2025

The expected usage currently would be to use async-compat, like so:

let mut writer = ZipFileWriter::with_tokio(Cursor::new(Vec::new()));
let entry = ZipEntryBuilder::new("test.txt".into(), Compression::Deflate);
let writer = writer.write_entry_stream(entry.build()).await.unwrap().compat_write();

I know this isn't ideal, so I'm very much open to ideas of making the compatibility layer between the base implementation and tokio better. Will have a think about if we want to do it this way.

@untitaker
Copy link
Author

well, the other option i see is to make the writer generic over the inner writer, and expose a type alias like type TokioEntryStreamWriter = EntryStreamWriter<Compat<???>>. but to be honest i find all of that very confusing because now you have additional generics and type aliases as part of the public documentation. tbh i wish that even in the case of ZipFileWriter it was hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants