Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zipruby or rubyzip?

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?

like image 926
vaughanos Avatar asked Aug 02 '11 03:08

vaughanos


2 Answers

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.

like image 103
Kelvin Avatar answered Sep 28 '22 00:09

Kelvin


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.

like image 21
Dan Rosenstark Avatar answered Sep 28 '22 02:09

Dan Rosenstark