I've got a ruby on rails site here (rails 2.0.2, ruby 1.8.6) with both rubyzip and zipruby installed, but they conflict on the File.exists? method so I want to remove one. What's the general consensus out there on the best zipping api going forward?
Are there significant advantages of one over another?
From what I've seen, rubyzip sometimes handles zip files strangely because it does its own handling of the zip file index and records. For example, if you use rubyzip to unpack a docx file and repack it, Microsoft Word won't open it. But zipruby uses the very standard libzip C library (with slight customizations) and won't mangle a docx. So if you're aiming for format compatibility, I'd suggest using zipruby. Maybe rubyzip has improved since I tried it - but you should try it yourself.
Totally random answer, as I've never tried either: moving forward from your current state, RubyZip might be more promising. Judging from the following (scant) data, RubyZip is both more popular and seems to work better with new versions of Ruby:
RubyZip with 1.9: http://isitruby19.com/rubyzip
ZipRuby with 1.9: http://isitruby19.com/zipruby
Unless you get some better evidence, I'd go with rubyZip. Also see What zip library works well with Ruby 1.9.2?. However, there's also a fork of RubyZip (https://github.com/postmodern/rubyzip2) again pointing to its popularity. And the docs looks more interesting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With