Majored / rs-async-zip

An asynchronous ZIP archive reading/writing crate.
MIT License
131 stars 44 forks source link

Broken pipe occurs. #124

Closed yossyX closed 7 months ago

yossyX commented 7 months ago

Thank you for the excellent library.

I am using async_zip::base::read::stream::ZipFileReader to handle the reading of a compressed ZIP file containing a large number of files. However, I am encountering a broken pipe in the DuplexStream on the sender side. Could this be due to dropping the reader without reading the central directory of the ZIP file?

I apologize for any difficulty in explaining, as English is not my strong suit. Your confirmation on this matter would be greatly appreciated.

Majored commented 7 months ago

That does sound like a plausible explanation if you're using the streaming read. What you probably want to do is call into_inner once all files have been read, and then just read that until EOF.

yossyX commented 7 months ago

@Majored I have already tried it. Since next_with_entry consumes the ZipFileReader and returns None when it has been executed until the end, the ZipFileReader is lost. Therefore, I believe that into_inner cannot be executed afterward.

Majored commented 7 months ago

Ah, good point. How's about only passing a mutable reference to ZipFileReader?

yossyX commented 7 months ago

Excellent! Indeed, the reader was able to use a mutable reference again and read the data to the end. However, it is a subtle issue that might be easily overlooked, so it would be helpful if there were an explanation somewhere. I appreciate your help. Thank you very much.