I'm trying to unzip a string I have in memory, but unfortunately I keep
getting a 'incorrect header check (Zlib::DataError)' when I try to unzip
the string.

The weird thing is that I can write the string out to a file, and unzip
it using gzip or even Zlib::GzipReader.

For example, using the same file, this works:

  require 'zlib'

  File.open(ARGV[0], 'r') { |f|
    gz = Zlib::GzipReader.new(f)
    puts gz.read
  }

But this doesn't (it fails with 'incorrect header check'):

  require 'zlib'

  File.open(ARGV[0], 'r') { |f|
    puts Zlib::Inflate.inflate(f.read)
  }

Anyone have any hints?  Thanks.

--Aaron