Skip to content

Instantly share code, notes, and snippets.

@marcocarvalho
Created July 2, 2013 19:50
Show Gist options
  • Save marcocarvalho/5912524 to your computer and use it in GitHub Desktop.
Save marcocarvalho/5912524 to your computer and use it in GitHub Desktop.
Create gzip readable files using ruby zlib
fn = "filename"
compressed_file_name = "#{fn}.gz"
Zlib::GzipWriter.open(compressed_file_name) do |gz|
gz.mtime = File.mtime(fn)
gz.orig_name = fn
gz.write IO.binread(fn)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment