Skip to content

Commit

Permalink
Add top-level comparison between GzDecoder and MultiGzDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 23, 2023
1 parent a232574 commit e21986e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,30 @@
//! `Write` trait if `T: Write`. That is, the "dual trait" is forwarded directly
//! to the underlying object if available.
//!
//! # About multi-member Gzip files
//!
//! While most `gzip` files one encounters will have a single *member* that can be read
//! with the [`GzDecoder`], there may be some files which have multiple members.
//!
//! If these are read with a [`GzDecoder`], only the first member will be consumed and
//! the rest will silently be left alone, which can be surprising.
//!
//! The [`MultiGzDecoder`] on the other hand will decode all *members* of `gzip` file
//! into one consecutive stream of bytes, which hides the underlying *members* entirely
//! while failing if the file does not contain solely `gzip` *members*.
//!
//! It's worth noting that major browser like Chrome, Firefox as well as tool like `curl`
//! will only decode the first member of a `gzip` encoded reply, so what's right to do
//! truly depends on the context, as well the expected input of the library or application.
//!
//! [`read`]: read/index.html
//! [`bufread`]: bufread/index.html
//! [`write`]: write/index.html
//! [read]: https://doc.rust-lang.org/std/io/trait.Read.html
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
//! [bufread]: https://doc.rust-lang.org/std/io/trait.BufRead.html
//! [`GzDecoder`]: read/struct.GzDecoder.html
//! [`MultiGzDecoder`]: read/struct.MultiGzDecoder.html
#![doc(html_root_url = "https://docs.rs/flate2/0.2")]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
Expand Down

0 comments on commit e21986e

Please sign in to comment.