Append to a zip file : zip « Development « Ruby






Append to a zip file


require 'zlib'

file = 'compressed.gz'
Zlib::GzipWriter.open(file) do |gzip|
  gzip << "this is a test."
  gzip.close
end


open('compressed.gz', 'wb') do |file|
  gzip = Zlib::GzipWriter.new(file)
  gzip << "this is a test."
  gzip.close
end

 








Related examples in the same category

1.Compressing and Archiving Files with Gzip and Tar
2.Inflate and deflate a string