diff --git a/lib/src/qmdl.rs b/lib/src/qmdl.rs index 78c41fe..1115ebf 100644 --- a/lib/src/qmdl.rs +++ b/lib/src/qmdl.rs @@ -37,18 +37,9 @@ where pub async fn write_container(&mut self, container: &MessagesContainer) -> std::io::Result<()> { for msg in &container.messages { - // for a gzipped file, we can't use `msg.data.len()` to - // determine the number of bytes written, so we have to - // manually do a `write_all()` type loop - let mut buf = Cursor::new(&msg.data); - loop { - let bytes_written = self.writer.write_buf(&mut buf).await?; - self.writer.flush().await?; - if bytes_written == 0 { - break; - } - self.total_uncompressed_bytes += bytes_written; - } + self.writer.write_all(&msg.data).await?; + self.writer.flush().await?; + self.total_uncompressed_bytes += msg.data.len(); } Ok(()) }