Created
July 2, 2013 19:50
-
-
Save marcocarvalho/5912524 to your computer and use it in GitHub Desktop.
Create gzip readable files using ruby zlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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