Forum: Ruby "All-in-one" archives library?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Victor S. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
Hi all.

I'd like to see some library which handles most popular archive types
(zip,
rar, tar, gz, bz2 ...) in uniform way, just like rubyzip[1] does:

require 'some-very-cool-library'

Dir['myarchive.zip'].each ...

Or even

Dir['myarchive.zip/otherone.rar/evenother.bz2'].each ...

Is something like this exists in the world?

Thanks.

Victor.

1. http://rubyzip.sourceforge.net
Austin Z. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
On 5/1/06, Victor S. <removed_email_address@domain.invalid> wrote:
>
> Is something like this exists in the world?

Can you drop me an email with what you'd really like to see? TRUG is
working on libarchive this weekend at a hackathon.

-austin
Dimitri A. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
On 5/2/06, Victor S. <removed_email_address@domain.invalid> wrote:
>
> Hi all.
>
> I'd like to see some library which handles most popular archive types
> (zip,
> rar, tar, gz, bz2 ...) in uniform way, just like rubyzip[1] does:
>

At the moment, there's archive-tar-external, which basically wraps calls
to
installed software with popen.  So, if you have all these tools
installed
already, you can do something like:

      require 'archive/tar_external'

      t = Archive::Tar::External.new( name )
      t.compressed_archive_name = name
      if name =~ /\.bz2/
        t.uncompress( "bunzip2" )
      elsif name =~ /\.gz/
        t.uncompress( "gunzip" )
      elsif name =~ /\.zip/
        t.uncompress( "unzip" )
      end
      if name =~ /\.t(ar\.)?(gz)?/
        t.extract
      end

HTH,

- Dimitri
This topic is locked and can not be replied to.