linesky 发表于 2011-01-19 01:16

Ruby 往压缩包中添加新文件

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
页: [1]
查看完整版本: Ruby 往压缩包中添加新文件