fs2 icon indicating copy to clipboard operation
fs2 copied to clipboard

fs2 gunzip doesn't support concatenated gzip files

Open dimitriho opened this issue 1 year ago • 0 comments

Steps to reproduce:

  • generate a compressed file
echo foo > foo; echo bar > bar; gzip -c foo bar > foobar.gz
  • run the following code
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import fs2.compression.Compression

import java.io.FileInputStream

fs2.io
  .readInputStream(
    IO(new FileInputStream("foobar.gz")),
    1024,
  )
  .through(Compression[IO].gunzip(1024))
  .flatMap(_.content)
  .compile
  .drain
  .unsafeRunSync()

This code snippet throws a java.util.zip.ZipException: Content failed CRC validation.

I expect it to run without error.

Tested on fs2 3.11.0

My gzip version is Apple gzip 430.140.2

dimitriho avatar Nov 19 '24 18:11 dimitriho