def save file
      wrap_with_rewind(@head_data, @tail_data, @compressed_data) do
        open(file, 'wb') do |io|
          io << @head_data.read
          chunk_size = @idat_chunk_size || @compressed_data.size
          type = 'IDAT'
          until @compressed_data.eof? do
            data = @compressed_data.read(chunk_size)
            io << [data.size].pack('N')
            io << type
            io << data
            io << [Zlib.crc32(data, Zlib.crc32(type))].pack('N')
          end
          io << @tail_data.read
        end
      end
      self
    end
def save file
      wrap_with_rewind(@head_data, @tail_data, @compressed_data) do
        open(file, 'wb') do |io|
          io << @head_data.read
          chunk_size = @idat_chunk_size || @compressed_data.size
          type = 'IDAT'
          until @compressed_data.eof? do
            data = @compressed_data.read(chunk_size)
            io << [data.size].pack('N')
            io << type
            io << data
            io << [Zlib.crc32(data, Zlib.crc32(type))].pack('N')
          end
          io << @tail_data.read
        end
      end
      self
    end
Save to the +file+.