Set compression level when generating a ZIP file using RubyZip
Here is the code I created by looking at rubyzip internal.
level = Zlib::BEST_COMPRESSION
Zip::ZipOutputStream.open(zip_file) do |zip|
Dir.glob("**/*") do |filename|
entry = Zip::ZipEntry.new("", filename)
entry.gather_fileinfo_from_srcpath(filename)
zip.put_next_entry(entry, nil, nil, Zip::ZipEntry::DEFLATED, level)
entry.get_input_stream { |is| IOExtras.copy_stream(zip, is) }
end
end
JS: Generating a zip file with store level compression
The zip file format is relatively straightforward. You can implement your own zip file creation routines that only produce stored entries. You can find the zip file format documented here.
How can I copy a directory inside a zip archive to a second zip archive using rubyzip?
After checking with one of the maintainers of the rubyzip gem, I have learned that this is not possible.
Related Topics
Running a Shell Command from Ruby: Capturing the Output While Displaying the Output
Is There an Easy-To-Use Ftp Library for Ruby
Are There "Rules" for Ruby Syntactic Sugar
"Ruby.Exe Is Not Recognized as an Internal or External Command" in Windows 7
Date Range Facets with Sunspot in Ruby on Rails
Disable Devise's :Confirmable On-The-Fly to Batch-Generate Users
What Ide/Editor Do You Use for Ruby on Linux
Getting All Links of a Webpage Using Ruby
Why Is a String Key for a Hash Frozen
Using Negative Conditions Within Regular Expressions
Working with a Large Data Object Between Ruby Processes
Rails Elasticsearch Aggregation
Sass: Dealing with The Ie 4095 Selectors Per Stylesheet Restriction
Ruby - Problems with Expect and Pty