Zlib file decompression EOL issue

Hi, first thx for helping !

I'm trying to decompress some .gz files with zlip. Here's the code that
i use, taken from here
http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/
and modified to fit my needs.

File::open(compressedFilePath.sub('.gz', ''), 'wb') do |unzipped_file|
      unzipped_file.binmode
      gz = File::open(compressedFilePath, 'rb')
      gz.binmode
      begin
        zis = Zlib::GzipReader.new(gz)
        puts zis.os_code()
        dis = zis.read
        io = StringIO.new(dis)
      ensure
        zis.finish if zis
      end
      unzipped_file.write(io.read)
      unzipped_file.flush
      unzipped_file.fsync
      gz.close
    end

The problem is, when i try to decompress FAT encoded files, only the
first line is read and managed. The GzipReader ignore the rest of the
file beyond the first line:

file object-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz

object-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz: gzip
compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

No problem when it's Unix encoded:

file error-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz

error-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz: gzip
compressed data, was "error-TS1T-AA-CS-C-0123-2005.08", from Unix, last
modified: Thu Apr 10 14:02:51 2008

I suspect EOL issue, but i can't find a workaround. Any suggestions are
welcome.

···

--
Posted via http://www.ruby-forum.com/\.