Gzip vs Deflate vs Zlib — pick the right decoder
All three formats use the same DEFLATE algorithm but differ in their wrapper. Gzip (RFC 1952) starts with magic bytes 0x1F 0x8B and ends with a CRC-32 + ISIZE trailer. Zlib (RFC 1950) starts with a 2-byte header (typically 0x78 0x9C) and ends with Adler-32. Raw deflate (RFC 1951) has no wrapper at all. If your input is not gzip, switch to the matching tool.
This decoder uses the browser's built-in DecompressionStream('gzip') — the same engine that decodes fetch() responses with Content-Encoding: gzip. CRC and length are validated automatically.