Zipruby or rubyzip?

I have a ruby ​​on a rails site (rails 2.0.2, ruby ​​1.8.6) with both rubyzip and zipruby installed, but do they conflict with File.exists? method, so I want to remove it. What is the general consensus on how best to move forward?

Are there any significant advantages of one over the other?

+6
source share
6 answers

A completely random answer, as I have never tried: moving from your current state, RubyZip may be more promising. Judging by the following (scarce) data, RubyZip is more popular and seems to work better with newer versions of Ruby:

RubyZip since 1.9: http://isitruby19.com/rubyzip

ZipRuby since 1.9: http://isitruby19.com/zipruby

If you don't get any more evidence, I would go with rubyZip. Also see Which zip library works well with Ruby 1.9.2? . However, there is also a RubyZip plug ( https://github.com/postmodern/rubyzip2 ), again indicating its popularity. And the documents look more interesting.

+2
source

From what I saw, rubyzip sometimes processes zip files strangely, because it does its own processing of the zip file index and records. For example, if you use rubyzip to unpack the docx file and repack it, Microsoft Word will not open it. But zipruby uses the most standard libzip C library (with a little tweaking) and will not cripple docx. Therefore, if you are aiming for compatibility with the format, I would suggest using zipruby. Rubyzip may have improved since I tried - but you should try it yourself.

+17
source

I used https://github.com/toretore/zippy gem a lot and I think this is not bad. This is a rubyzip shell, and it greatly simplifies operations with zip files.

0
source

If you need only one file or several files from a zip file, you can try using Pinch , which will allow you to extract the file via http in ruby

Pinch: extract a file from a ZIP file over the network!

0
source

rubyzip doesn't seem to be password protected, but zipruby does: link

0
source

It looks like rubyzip might store the wrong uncompressed value for the file, which causes some files to fail without compression (for example, miniz) when uncompressed. zipruby looks like it keeps the correct uncompressed size. I'm going to go with a zip test.

0
source

Source: https://habr.com/ru/post/894080/


All Articles